Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 119 → Rev 118

/trunk/DBViewer/database.cpp
354,12 → 354,6
QString ID;
QString inctance;
QString filtr_tmp;
 
disconnect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
 
ui->pushButton->setEnabled(false);
ui->pushButton_2->setEnabled(false);
 
class_id = parent_item->text(2);
ID = item->text(2);
inctance = parent_item->text(3);
367,8 → 361,7
sql_mogel = new QSqlTableModel();
// sql_mogel = new QSqlTableModel(this);
sql_mogel->setTable(inctance);
// sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
sql_mogel->setEditStrategy(QSqlTableModel::OnManualSubmit);
sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
 
filtr_tmp.append(tr("`"));
filtr_tmp.append(tr("ID"));
381,8 → 374,6
ui->tableView->setModel(sql_mogel);
ui->tableView->resizeColumnsToContents();
 
connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
 
//sql_mogel->clear();
//sql_mogel->select();
// ui->tableView->setVisible(false);
397,11 → 388,6
QString filtr_tmp;
// sql_mogel->clear();
 
ui->pushButton->setEnabled(true);
ui->pushButton_2->setEnabled(true);
 
disconnect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
 
parent_object_id = parent_item->text(2);
 
parentObject_id = parent_item->text(2);
414,8 → 400,7
sql_mogel = new QSqlTableModel();
// sql_mogel = new QSqlTableModel(this);
sql_mogel->setTable(inctance);
// sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
sql_mogel->setEditStrategy(QSqlTableModel::OnManualSubmit);
sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
 
if (!parent_object_id.isEmpty())
{
433,10 → 418,7
 
ui->tableView->setModel(sql_mogel);
 
connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
 
 
// ui->tableView->setVisible(true);;
// ui->tableView->setVisible(true);;
i++;
}
 
458,43 → 440,6
if (pointer_index > 0) {
sql_mogel->setData(sql_mogel->index(row, pointer_index), QVariant(parentObject_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "èìÿ êëàññà"
}
// sql_mogel->submitAll();
sql_mogel->submitAll();
 
}
 
void MainWindow::on_pushButton_2_clicked(){ // íàæàòèå êíîïêè "Óäàëèòü âûäåëåííûå îáúåêòû"
int i;
i++;
 
}
 
 
void MainWindow::on_pushButton_3_clicked(){ // íàæàòèå êíîïêè "Ïðèìåíèòü"
int i;
i++;
sql_mogel->submitAll();
getDatabaseData();
ui->pushButton_3->setEnabled(false);
ui->pushButton_4->setEnabled(false);
sql_mogel->select();
 
}
 
 
void MainWindow::on_pushButton_4_clicked(){ // íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ"
int i;
i++;
sql_mogel->select();
ui->pushButton_3->setEnabled(false);
ui->pushButton_4->setEnabled(false);
}
 
 
void MainWindow::on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
int i;
i++;
ui->pushButton_3->setEnabled(true);
ui->pushButton_4->setEnabled(true);
 
 
}
/trunk/DBViewer/mainwindow.ui
183,32 → 183,6
<string>Удалить объект</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_3">
<property name="geometry">
<rect>
<x>10</x>
<y>510</y>
<width>151</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Применить</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton_4">
<property name="geometry">
<rect>
<x>269</x>
<y>510</y>
<width>211</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Сбросить изменения</string>
</property>
</widget>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
/trunk/DBViewer/mainwindow.cpp
29,11 → 29,6
getDatabaseData();
sql_mogel = new QSqlTableModel();
model_is_build = true;
connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
ui->pushButton_3->setEnabled(false);
ui->pushButton_4->setEnabled(false);
 
 
}
 
MainWindow::~MainWindow()
/trunk/DBViewer/mainwindow.h
103,11 → 103,7
void on_treeWidget_itemChanged ( QTreeWidgetItem * item, int column );
void on_treeWidget_itemClicked ( QTreeWidgetItem * item, int column );
void on_treeWidget_2_itemClicked ( QTreeWidgetItem * item, int column );
void on_pushButton_clicked(); // íàæàòèå êíîïêè "Äîáàâèòü îáúåêò"
void on_pushButton_2_clicked();// íàæàòèå êíîïêè "Óäàëèòü âûäåëåííûå îáúåêòû"
void on_pushButton_3_clicked();// íàæàòèå êíîïêè "Ïðèìåíèòü"
void on_pushButton_4_clicked();// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ"
void on_sql_mogel_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
void on_pushButton_clicked();
 
};