Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 222 → Rev 223

/trunk/DBViewer/database.cpp
203,6 → 203,8
QString pointerField; // èìÿ ïîëÿ-óêàçàòåëÿ íà ðîäèòåëüñêèé êëàññ
QString inctance; // èìÿ òàáëèöû, õðàíèëèùà
QString className; // èìÿ êëàññà
QString modelID; // èäåíòèôèêàòîð ìîäåëè
QString add_filtr; // äîïîëíèòåëüíûé ôèëüòð
int field_ID;
int icon_field_index;
bool filtr_empty;
216,8 → 218,12
// font.setWeight(40);
font.setBold(true);
filtr_empty = filtr.isEmpty();
 
classID = model_item->text(1);
modelID = model_item->text(6);
add_filtr = MainWindow::getFiltrString(modelID, classID);
 
 
icon = model_item->icon(0);
 
parentClassID = model_item->parent()->text(1);
236,6 → 242,7
title_item->setText(2, classID);
title_item->setText(3, inctance);
title_item->setText(4, pointerField);
title_item->setText(5, add_filtr); // çàïîìíèì ôèëüòð äëÿ êëàññà â äåðåâå ñ äàííûìè
title_item->setTextColor(0, Qt::darkBlue);
 
title_item->setIcon(0, icon);
245,6 → 252,15
" from " //íàõîäèì âñå îáúåêòû êëàññà â òàáëèöå - õðàíèëèùå îáúåêòîâ êëàññà
);
sql_str.append(inctance);
 
 
if (filtr.isEmpty() && (!add_filtr.isEmpty())) // ôèëüòð ïóñòîé, äîïîëíèòåëüíûé ôèëüòð íå ïóñòîé
{
filtr.append(tr ("where "));
filtr.append(add_filtr);
}
 
 
if (!filtr.isEmpty()) { // åñëè ôèëüòð íå ïóñòîé
sql_str.append(tr(" "));
sql_str.append(filtr); // äîáàâëÿåì â çàïðîñ ôèëüòð
515,6 → 531,7
QString parent_object_id; // èäåíòèôèêàòîð ðîäèòåëüñêîãî îáúåêòà
 
QString parent_class_inctance;
QString class_filter;
 
 
ui->pushButton->setEnabled(true);
526,6 → 543,7
 
class_id = item->text(2);
inctance = item->text(3);
class_filter = item->text(5);
 
pointer_name = item->text(4);
delete sql_mogel;
546,9 → 564,23
filtr_tmp.append(parent_object_id);
filtr_tmp.append(tr("'"));
 
 
if (!class_filter.isEmpty()) // åñëè ôèëüòð äëÿ êëàññà íå ïóñòîé
{
filtr_tmp.append(tr(" and "));
filtr_tmp.append(class_filter); // äîáàâèì è ôèëüòð äëÿ êëàññà (êîòîðûé óêàçûâàëè â äåðåâå ìîäåëåé)
 
}
 
 
 
 
}
else if(!class_filter.isEmpty()) // åñëè ôèëüòð äëÿ êëàññà íå ïóñòîé)
{
filtr_tmp.append(class_filter); // äîáàâèì è ôèëüòð äëÿ êëàññà (êîòîðûé óêàçûâàëè â äåðåâå ìîäåëåé)
}
 
 
}
 
 
869,7 → 901,9
 
void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
{
ui->tableView_3->setModel(filter_model);
filter_model->select();
 
ui->pushButton_11->setEnabled(false);
ui->pushButton_12->setEnabled(false);
}
1415,13 → 1449,13
 
 
result_str.append(Condition);
result_str.append(tr(" "));
result_str.append(tr(" `"));
result_str.append(FieldName);
result_str.append(tr(" "));
result_str.append(tr("`"));
result_str.append(ConditionalSymbol);
result_str.append(tr(" "));
result_str.append(tr("'"));
result_str.append(ValueForComparison);
result_str.append(tr(" "));
result_str.append(tr("' "));
result_str.append(PostCondition);
 
 
/trunk/DBViewer/mainwindow.ui
76,6 → 76,11
<string>Поле-указатель</string>
</property>
</column>
<column>
<property name="text">
<string>Фильтр</string>
</property>
</column>
</widget>
</item>
<item>
/trunk/DBViewer/mainwindow.cpp
84,9 → 84,11
getDatabaseData();
//// sql_mogel = new QSqlTableModel();
sql_mogel = new MyModel();
filter_model = new MyModel();
 
/// filter_model = new MyModel();
filter_model = new QSqlTableModel();
 
 
model_is_build = true;
connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
connect(model_for_ListModelsTable, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_model_for_ListModelsTable_dataChanged(QModelIndex,QModelIndex)));
864,8 → 866,11
// MainWindow::filtr_model->clear();
disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
delete filter_model;
filter_model = new QSqlTableModel();
connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
 
filter_model = new QSqlTableModel();
/// filter_model = new MyModel();
 
connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
int index;
classesID_list = class_list_map.keys();
classesNameList = class_list_map.values();
903,7 → 908,7
 
disconnect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
delete filter_model;
// filtr_model = new MyModel();
/// filter_model = new MyModel();
 
filter_model = new QSqlTableModel();
connect(filter_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_filter_model_dataChanged(QModelIndex,QModelIndex)));
958,7 → 963,7
 
model_for_ListModelsTable->select();
 
/*
 
ui->treeWidget->hideColumn(1);
ui->treeWidget->hideColumn(2);
ui->treeWidget->hideColumn(3);
965,7 → 970,7
ui->treeWidget->hideColumn(4);
// ui->treeWidget->hideColumn(5);
ui->treeWidget->hideColumn(6);
*/
 
ui->tableView_2->hideColumn(0);
ui->tableView_2->hideColumn(2);
ui->tableView_2->hideColumn(3);
/trunk/DBViewer/mainwindow.h
111,7 → 111,7
/////// QSqlTableModel * sql_mogel;
 
MyModel * sql_mogel;
// MyModel * filtr_model;
//// MyModel * filter_model;
 
QSqlTableModel * filter_model;