Хранилища Subversion OpenInventory

Сравнить редакции

Не учитывать пробелы Редакция 232 → Редакция 233

/trunk/DBViewer/mainwindow.ui
380,6 → 380,82
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Отчет</string>
</attribute>
<widget class="QWidget" name="horizontalLayoutWidget_3">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>1051</width>
<height>561</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QPushButton" name="pushButton_13">
<property name="text">
<string>Сформировать краткий отчёт</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_14">
<property name="text">
<string>Сформировать подробный отчёт</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_15">
<property name="text">
<string>Печать</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_16">
<property name="text">
<string>Печать в PDF</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_17">
<property name="text">
<string>Экспортировать OpenOffice</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QTextEdit" name="textEdit"/>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
/trunk/DBViewer/iconform.ui
29,7 → 29,7
<string/>
</property>
<property name="icon">
<iconset resource="pic.qrc">
<iconset resource="dbviewer.qrc">
<normaloff>:/Open.png</normaloff>:/Open.png</iconset>
</property>
</widget>
36,8 → 36,8
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<x>30</x>
<y>0</y>
<width>31</width>
<height>30</height>
</rect>
46,7 → 46,7
<string/>
</property>
<property name="icon">
<iconset resource="pic.qrc">
<iconset resource="dbviewer.qrc">
<normaloff>:/Delete.png</normaloff>:/Delete.png</iconset>
</property>
</widget>
53,9 → 53,9
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>30</x>
<x>70</x>
<y>0</y>
<width>101</width>
<width>61</width>
<height>71</height>
</rect>
</property>
68,7 → 68,7
</widget>
</widget>
<resources>
<include location="pic.qrc"/>
<include location="dbviewer.qrc"/>
</resources>
<connections/>
</ui>
/trunk/DBViewer/mainwindow.cpp
16,6 → 16,7
ui->centralWidget->setLayout(ui->verticalLayout);
ui->tab->setLayout(ui->horizontalLayout);
ui->tab_2->setLayout(ui->horizontalLayout_3);
ui->tab_3->setLayout(ui->horizontalLayout_7);
// connect( ui->comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_currentIndexChanged(int)));
model_is_build = false;
// MainWindow::readModel();
119,11 → 120,11
 
// fileForm.show();
 
doc = ui->textEdit->document();
cursor = new QTextCursor(doc);
// buildReport(true);
 
cursor = new QTextCursor(&doc);
buildReport(true);
 
 
}
 
MainWindow::~MainWindow()
755,6 → 756,7
QMapIterator<QString, QString> interator(class_list_map);
// ui->comboBox->addItems(classesID_list);
// ui->comboBox->addItems(classesNameList);
 
while (interator.hasNext()) {
interator.next();
tmp_str = interator.value();
764,6 → 766,7
tmp_stringList << tmp_str;
 
}
tmp_stringList << tr("íå çàäàíî");
// int count = ui->comboBox->count();
 
ui->comboBox->clear();
882,6 → 885,9
classesNameList = class_list_map.values();
if (item->childCount()>0) index = classesID_list.indexOf(item->child(0)->text(1)); // åñëè ìîäåëü íå ïóñòàÿ, óçíàåì êîðíåâîé êëàññ
else { // åñëè ïóñòàÿ
index = classesID_list.count();
comboBox_slot_enable = false; // ÷òîáû ñëîò comboBox íå ìåíÿë ñòðîêó ìîäåëè
ui->comboBox->setCurrentIndex(index);
ui->comboBox->setEnabled(true);
comboBox_slot_enable = true;
return;
1021,7 → 1027,7
//int count = ui->treeWidget_2->rootIndex();
 
 
doc.clear();//î÷èùàåì äîêóìåíò
doc->clear();//î÷èùàåì äîêóìåíò
 
int list_count;
if (rootItems.isEmpty()) return;
1037,7 → 1043,7
 
 
}
(bool)QTextDocumentWriter("raport.odt").write(&doc);
// (bool)QTextDocumentWriter("raport.odt").write(doc);
}
 
 
1066,7 → 1072,13
QString rootClassID;
QString rootClassInctance;
QFont font;
QBrush brush;
 
brush.setColor(Qt::darkRed);
char_fmt.setForeground(brush);
font.setBold(true);
char_fmt.setFont(font);
 
model_name = model_item->text(0);
if (model_item->checkState(0) == false) return; // ìîäåëü íå âûäåëåíà äëÿ îòîáðàæåíèÿ
 
1091,7 → 1103,7
rootClassID = model_item->child(0)->text(1);
rootClassInctance = getClassInctance(rootClassID);
 
cursor->insertText(model_name);
cursor->insertText(model_name, char_fmt);
cursor->insertText(tr("\n"));
 
if (model_item->child(0)->checkState(0)) // åñëè â ìîäåëè êîðíåâîé êëàññ âûáðàí äëÿ îòîáðàæåíèÿ (ñòîèò ãàëî÷êà), òî
1128,7 → 1140,7
QString sql_str;
QString str_tmp;
QTreeWidgetItem * title_item;
QFont font;
 
QIcon icon;
QMap<QString, QString> fieldsTypesList;//çäåñü â êà÷åñòâå êëþ÷å áóäåì õðàíèòü èìåíà ïîëåé, çíà÷åíèÿìè áóäóò èõ òèïû
//QList<TField> FieldsList; //ñïèñîê ïîëåé êëàññà
1136,7 → 1148,7
 
 
 
font.setBold(true);
// // // font.setBold(true);
filtr_empty = filtr.isEmpty();
 
classID = model_item->text(1);
1158,12 → 1170,38
 
 
 
QTextCharFormat charFormatItalic, charFormatBase;
QTextCharFormat charFormatItalic, charFormatBase, charFormatItalicBold, charFormatItalicOnly;
QTextTableFormat tableFormat;
 
 
// QPen pen;
QBrush brush;
QFont font;
// pen.setColor(Qt::red);
// charFormatItalic.setTextOutline(pen);
 
//QFont font;
font.setBold(true);
 
brush.setColor(Qt::blue);
 
font.setItalic(true);
 
charFormatItalicOnly.setFont(font);
//charFormatItalic.setFontItalic(true);
 
font.setBold(true);/////////////////
charFormatItalic.setFont(font);
 
 
charFormatItalic.setForeground(brush);
 
 
 
charFormatItalicBold.setFont(font);
charFormatItalicBold.setForeground(brush);
 
 
 
//charFormatItalic.setFontWeight(16);
pos++;
for(int i=0; i<pos; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû
1302,7 → 1340,7
 
 
pix.toImage().save(fname);
doc.addResource(QTextDocument::ImageResource, QUrl(fname), pix.toImage());
doc->addResource(QTextDocument::ImageResource, QUrl(fname), pix.toImage());
 
// for(int i=0; i<pos; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû
 
1455,18 → 1493,30
 
 
 
// for(int i=0; i<pos+1; i++){ cursor->insertText( tr(" "));}// äîáàâëÿåì ïðîáåëû
tableFormat.setAlignment(Qt::AlignLeft);
tableFormat.setBackground(QColor("#e0e0e0"));
// tableFormat.setCellPadding(2);
// tableFormat.setCellSpacing(4);
tableFormat.setLeftMargin(pos*7);
tableFormat.setBorder(1);
tableFormat.setBorderStyle( QTextFrameFormat::BorderStyle_Solid);
 
QTextTable *table = cursor->insertTable(fieldsValues.count(), 2);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà)
for(int i=0; i < fieldsValues.count(); i++){ // ïðîïóñòèì ïîëÿ: ID è ïîëå, ñîäåðæàùåå èìÿ îáúåêòà (îíî è òàê óæå îòîáðàæåíî)
QTextTable *table = cursor->insertTable(fieldsValues.count(), 2, tableFormat);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà)
// table->setFormat(tableFormat);
 
 
for(int i=0; i < fieldsValues.count(); i++){ // ïðîïóñòèì ïîëÿ: ID è ïîëå, ñîäåðæàùåå èìÿ îáúåêòà (îíî è òàê óæå îòîáðàæåíî)
QStringList keys_list = fieldsValues.keys();
QStringList values_list = fieldsValues.values();
*cursor = table->cellAt(i,0).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö ïåðâûé
cursor->insertText(keys_list.at(i));//ñþäà çàíîñèì èìÿ ïîëÿ
cursor->insertText(keys_list.at(i), charFormatItalicOnly);//ñþäà çàíîñèì èìÿ ïîëÿ
*cursor = table->cellAt(i,1).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö âòîðîé
cursor->insertText(values_list.at(i));//ñþäà çàíîñèì èìÿ ïîëÿ
}
 
cursor->movePosition(QTextCursor::End);//âûõîäèì èç òàáëèöû
// table->setFormat(tableFormat);
cursor->movePosition(QTextCursor::End);//âûõîäèì èç òàáëèöû
cursor->insertText( tr("\n"));
 
 
1554,7 → 1604,7
//MainWindow::showObjectChildrens(ID_tmp, itm, model_item_tmp);
 
}
if(pos==2) newPage(); // åñëè ýòî êîðíåâîé êëàññ, âñòàâèì ðàçäåë ñòðàíèöû
// if(pos==2) newPage(); // åñëè ýòî êîðíåâîé êëàññ, âñòàâèì ðàçäåë ñòðàíèöû
 
}
 
/trunk/DBViewer/mainwindow.h
189,7 → 189,7
 
QMap <QString, QPixmap> classesIcons;
 
QTextDocument doc;
QTextDocument * doc;
QTextCursor * cursor;
 
 
211,6 → 211,11
void on_pushButton_10_clicked();// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ)
void on_pushButton_11_clicked();// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ)
void on_pushButton_12_clicked();// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
void on_pushButton_13_clicked();// íàæàòèå êíîïêè "Ñôîðìèðîâàòü êðàòêèé îò÷åò" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_14_clicked();// íàæàòèå êíîïêè "Ñôîðìèðîâàòü ïîëíûé îò÷åò" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_15_clicked();// íàæàòèå êíîïêè "Ïå÷àòü" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_16_clicked();// íàæàòèå êíîïêè "Ïå÷àòü â PDF" (íà âêëàäêå îò÷åòîâ)
void on_pushButton_17_clicked();// íàæàòèå êíîïêè "Ýêñïîðò â OpenOffice" (íà âêëàäêå îò÷åòîâ)
 
void on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
void on_model_for_ListModelsTable_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
/trunk/DBViewer/database.cpp
819,6 → 819,7
 
}
model_for_ListModelsTable->submitAll();
ui->pushButton_7->setEnabled(true);
// getDatabaseData();
 
}
937,7 → 938,58
ui->pushButton_12->setEnabled(false);
}
 
void MainWindow::on_pushButton_13_clicked()// íàæàòèå êíîïêè "Ñôîðìèðîâàòü êðàòêèé îò÷åò" (íà âêëàäêå îò÷åòîâ)
{
buildReport(false);
 
}
 
void MainWindow::on_pushButton_14_clicked()// íàæàòèå êíîïêè "Ñôîðìèðîâàòü ïîëíûé îò÷åò" (íà âêëàäêå îò÷åòîâ)
{
buildReport(true);
 
}
 
void MainWindow::on_pushButton_15_clicked()// íàæàòèå êíîïêè "Ïå÷àòü" (íà âêëàäêå îò÷åòîâ)
{
QPrinter printer;
QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (dlg->exec() !=QDialog::Accepted) return;
doc->print(&printer);
 
}
 
 
void MainWindow::on_pushButton_16_clicked()// íàæàòèå êíîïêè "Ïå÷àòü â PDF" (íà âêëàäêå îò÷åòîâ)
{
QString fileName = QFileDialog::getSaveFileName(this, "Export PDF", "", "PDF Files (*.pdf)");
if(!fileName.isEmpty()){
if (QFileInfo(fileName).suffix().isEmpty())
fileName.append(".pdf");
QPrinter printer(QPrinter::HighResolution);
printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
doc->print(&printer);
}
 
}
 
void MainWindow::on_pushButton_17_clicked()// íàæàòèå êíîïêè "Ýêñïîðò â OpenOffice" (íà âêëàäêå îò÷åòîâ)
 
{
QString fileName = QFileDialog::getSaveFileName(this, "Export ODT", "", "OpenOffice document (*.odt)");
 
if(!fileName.isEmpty()){
if (QFileInfo(fileName).suffix().isEmpty())
fileName.append(".odt");
(bool)QTextDocumentWriter(fileName).write(doc);
 
}
 
 
}
 
 
void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
int i;
i++;