Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 118 → Rev 119

/trunk/DBViewer/mainwindow.h
103,7 → 103,11
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_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 ); // èçìåíèëè ñâîéñòâà îáúåêòà èëè äîáàâèëè íîâûé îáúåêò
 
};
 
/trunk/DBViewer/database.cpp
354,6 → 354,12
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);
361,7 → 367,8
sql_mogel = new QSqlTableModel();
// sql_mogel = new QSqlTableModel(this);
sql_mogel->setTable(inctance);
sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
// sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
sql_mogel->setEditStrategy(QSqlTableModel::OnManualSubmit);
 
filtr_tmp.append(tr("`"));
filtr_tmp.append(tr("ID"));
374,6 → 381,8
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);
388,6 → 397,11
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);
400,7 → 414,8
sql_mogel = new QSqlTableModel();
// sql_mogel = new QSqlTableModel(this);
sql_mogel->setTable(inctance);
sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
// sql_mogel->setEditStrategy(QSqlTableModel::OnFieldChange);
sql_mogel->setEditStrategy(QSqlTableModel::OnManualSubmit);
 
if (!parent_object_id.isEmpty())
{
418,7 → 433,10
 
ui->tableView->setModel(sql_mogel);
 
// ui->tableView->setVisible(true);;
connect(sql_mogel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_sql_mogel_dataChanged(QModelIndex,QModelIndex)));
 
 
// ui->tableView->setVisible(true);;
i++;
}
 
440,6 → 458,43
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,6 → 183,32
<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,6 → 29,11
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()