Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 214 → Rev 215

/trunk/DBViewer/mainwindow.cpp
144,7 → 144,7
model_str = QString(tr(file.readAll()));
}
 
setupModelData(model_str.split(QString("\n")), rootItem1, -1);
setupModelData(model_str.split(QString("\n")), rootItem1, -1, tr("1"));
 
 
return result;
152,7 → 152,7
}
 
 
void MainWindow::setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row)
void MainWindow::setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row, QString model_id)
{
QList<QTreeWidgetItem*> parents;
QList<int> indentations;
197,7 → 197,7
// // // parents.last()->appendChild(new QTreeWidgetItem(columnData, parents.last()));
QTreeWidgetItem* itm_tmp;
itm_tmp = new QTreeWidgetItem( parents.last());
itm_tmp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
// itm_tmp->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
 
/*
QLineEdit * edit_line;
223,10 → 223,12
 
// itm_tmp->setText(1, QString(columnData.at(2).toString())); // id êëàññà
itm_tmp->setText(1, class_id); // id êëàññà
itm_tmp->setText(6, model_id); // id ìîäåëè
itm_tmp->setText(2, QVariant(number).toString()); // íîìåð ñòðîêè â ôàéëå-ìîäåëè îòîáðàæåíèÿ
itm_tmp->setText(3, QVariant(indentations.size()).toString()); // óðîâåíü âëîæåíèÿ
itm_tmp->setText(4, QVariant(row).toString()); // íîìåð ñòðîêè â ôàéëå
 
 
if (!pxmp.isNull())
{
icon.addPixmap(pxmp);
857,7 → 859,28
// if ((rootItem1) == (item) ) ui->comboBox->setEnabled(true);
else // âûáðàííûé èòåì ñîäåðæèò íàçâàíèå êëàññà
{
( ui->comboBox->setEnabled(false));
QString class_id;
QString model_id;
QString filtr_str;
class_id = item->text(1);
model_id = item->text(6);
filtr_str = tr("`Model_ID` = `");
filtr_str.append(model_id);
filtr_str.append(tr("` AND `Class_ID` = `"));
filtr_str.append(class_id);
filtr_str.append(tr("`"));
 
delete filtr_model;
filtr_model = new MyModel();
 
filtr_model->setTable(tr("Filters"));
filtr_model->setFilter(filtr_str);
filtr_model->select();
ui->tableView_3->setModel(filtr_model);
 
ui->comboBox->setEnabled(false);
 
 
}
}
 
876,12 → 899,13
 
model_for_ListModelsTable->select();
 
/*
 
ui->treeWidget->hideColumn(1);
ui->treeWidget->hideColumn(2);
ui->treeWidget->hideColumn(3);
ui->treeWidget->hideColumn(4);
*/
ui->treeWidget->hideColumn(5);
ui->treeWidget->hideColumn(6);
 
ui->tableView_2->hideColumn(0);
ui->tableView_2->hideColumn(2);
/trunk/DBViewer/mainwindow.h
85,7 → 85,7
QTreeWidgetItem *rootItem1, *rootItem2;
void openBase();
bool readModel();
void setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row); // row - íîìåð ñòðîêè â òàáëèöå ìîäåëåé, ñîîòâåòñòâóþùèé äàííîé ìîäåëè
void setupModelData(const QStringList &lines, QTreeWidgetItem *parent, int row, QString model_id); // row - íîìåð ñòðîêè â òàáëèöå ìîäåëåé, ñîîòâåòñòâóþùèé äàííîé ìîäåëè
QString creatModelString(QTreeWidgetItem* model);
QString modelString; // ñòðîêà, îïèñûâàþùàÿ ìîäåëü ïðåäñòàâëåíèÿ
void addChildsString(QTreeWidgetItem *parentItem, int level);
181,6 → 181,7
void on_pushButton_6_clicked();// íàæàòèå êíîïêè "Óäàëèòü ìîäåëü "
void on_pushButton_7_clicked();// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ìîäåëåé)
void on_pushButton_8_clicked();// íàæàòèå êíîïêè "Îòìåíèòü" (íà âêëàäêå ìîäåëåé)
void on_pushButton_9_clicked();// íàæàòèå êíîïêè "Äîáàâèòü ôèëüòð" (íà âêëàäêå ìîäåëåé)
void on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
void on_model_for_ListModelsTable_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
void applySetting();
/trunk/DBViewer/database.cpp
809,6 → 809,20
 
}
 
 
void MainWindow::on_pushButton_9_clicked()// íàæàòèå êíîïêè "Äîáàâèòü ôèëüòð" (íà âêëàäêå ìîäåëåé)
{
QString class_id;
QString model_id;
class_id = ui->treeWidget->currentItem()->text(1);
model_id = ui->treeWidget->currentItem()->text(6);
int row = filtr_model->rowCount();
filtr_model->insertRows(row, 1);
filtr_model->setData(filtr_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
filtr_model->setData(filtr_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
 
}
 
void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
int i;
i++;
1192,7 → 1206,7
 
modelString = model_for_ListModelsTable->data(model_for_ListModelsTable->index(i, 2)).toString();
if (modelString.isEmpty()) continue;
else setupModelData(modelString.split(QString("\n")), item_tmp, i); // ñòðîèì ìîäåëü
else setupModelData(modelString.split(QString("\n")), item_tmp, i, model_id); // ñòðîèì ìîäåëü
 
}