16,7 → 16,6 |
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(); |
120,11 → 119,11 |
|
// fileForm.show(); |
|
doc = ui->textEdit->document(); |
cursor = new QTextCursor(doc); |
// buildReport(true); |
|
cursor = new QTextCursor(&doc); |
buildReport(true); |
|
|
} |
|
MainWindow::~MainWindow() |
756,7 → 755,6 |
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(); |
766,7 → 764,6 |
tmp_stringList << tmp_str; |
|
} |
tmp_stringList << tr("íå çàäàíî"); |
// int count = ui->comboBox->count(); |
|
ui->comboBox->clear(); |
885,9 → 882,6 |
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; |
1027,7 → 1021,7 |
//int count = ui->treeWidget_2->rootIndex(); |
|
|
doc->clear();//î÷èùàåì äîêóìåíò |
doc.clear();//î÷èùàåì äîêóìåíò |
|
int list_count; |
if (rootItems.isEmpty()) return; |
1043,7 → 1037,7 |
|
|
} |
// (bool)QTextDocumentWriter("raport.odt").write(doc); |
(bool)QTextDocumentWriter("raport.odt").write(&doc); |
} |
|
|
1072,13 → 1066,7 |
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; // ìîäåëü íå âûäåëåíà äëÿ îòîáðàæåíèÿ |
|
1103,7 → 1091,7 |
rootClassID = model_item->child(0)->text(1); |
rootClassInctance = getClassInctance(rootClassID); |
|
cursor->insertText(model_name, char_fmt); |
cursor->insertText(model_name); |
cursor->insertText(tr("\n")); |
|
if (model_item->child(0)->checkState(0)) // åñëè â ìîäåëè êîðíåâîé êëàññ âûáðàí äëÿ îòîáðàæåíèÿ (ñòîèò ãàëî÷êà), òî |
1140,7 → 1128,7 |
QString sql_str; |
QString str_tmp; |
QTreeWidgetItem * title_item; |
|
QFont font; |
QIcon icon; |
QMap<QString, QString> fieldsTypesList;//çäåñü â êà÷åñòâå êëþ÷å áóäåì õðàíèòü èìåíà ïîëåé, çíà÷åíèÿìè áóäóò èõ òèïû |
//QList<TField> FieldsList; //ñïèñîê ïîëåé êëàññà |
1148,7 → 1136,7 |
|
|
|
// // // font.setBold(true); |
font.setBold(true); |
filtr_empty = filtr.isEmpty(); |
|
classID = model_item->text(1); |
1170,38 → 1158,12 |
|
|
|
QTextCharFormat charFormatItalic, charFormatBase, charFormatItalicBold, charFormatItalicOnly; |
QTextTableFormat tableFormat; |
|
|
// QPen pen; |
QBrush brush; |
QFont font; |
// pen.setColor(Qt::red); |
// charFormatItalic.setTextOutline(pen); |
|
QTextCharFormat charFormatItalic, charFormatBase; |
//QFont font; |
|
brush.setColor(Qt::blue); |
|
font.setBold(true); |
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(" "));}// äîáàâëÿåì ïðîáåëû |
1340,7 → 1302,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(" "));}// äîáàâëÿåì ïðîáåëû |
|
1493,30 → 1455,18 |
|
|
|
// 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, tableFormat);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà) |
// table->setFormat(tableFormat); |
|
|
for(int i=0; i < fieldsValues.count(); i++){ // ïðîïóñòèì ïîëÿ: ID è ïîëå, ñîäåðæàùåå èìÿ îáúåêòà (îíî è òàê óæå îòîáðàæåíî) |
QTextTable *table = cursor->insertTable(fieldsValues.count(), 2);// ñîçäàäèì òàáëèöó äëÿ ïîëåé êëàññà, êðîìå ïåðâûõ äâóõ (ID è íàçâàíèå îáúåêòà) |
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), charFormatItalicOnly);//ñþäà çàíîñèì èìÿ ïîëÿ |
cursor->insertText(keys_list.at(i));//ñþäà çàíîñèì èìÿ ïîëÿ |
*cursor = table->cellAt(i,1).firstCursorPosition();// ñòðîêà i-òàÿ, ñòîëáåö âòîðîé |
cursor->insertText(values_list.at(i));//ñþäà çàíîñèì èìÿ ïîëÿ |
} |
|
// table->setFormat(tableFormat); |
cursor->movePosition(QTextCursor::End);//âûõîäèì èç òàáëèöû |
cursor->movePosition(QTextCursor::End);//âûõîäèì èç òàáëèöû |
cursor->insertText( tr("\n")); |
|
|
1604,7 → 1554,7 |
//MainWindow::showObjectChildrens(ID_tmp, itm, model_item_tmp); |
|
} |
// if(pos==2) newPage(); // åñëè ýòî êîðíåâîé êëàññ, âñòàâèì ðàçäåë ñòðàíèöû |
if(pos==2) newPage(); // åñëè ýòî êîðíåâîé êëàññ, âñòàâèì ðàçäåë ñòðàíèöû |
|
} |
|