1
1
mirror of https://github.com/andre-wojtowicz/qt-sql-example.git synced 2024-11-26 15:45:27 +01:00

Fixed table view Tab switch;

Fixed removing unused data model
This commit is contained in:
Andrzej Wójtowicz 2017-09-03 19:04:05 +02:00
parent 7f285add6d
commit 810a6a5aa7
2 changed files with 27 additions and 1 deletions

View File

@ -166,6 +166,8 @@ void MainWindow::disconnectFromServerRequested()
{ {
ui->button_connect->setEnabled(false); ui->button_connect->setEnabled(false);
delete ui->tableView_database_table->model();
emit disconnectFromServer(); emit disconnectFromServer();
} }
@ -197,6 +199,8 @@ void MainWindow::showTableRequested()
{ {
ui->button_show_table->setEnabled(false); ui->button_show_table->setEnabled(false);
delete ui->tableView_database_table->model(); // remove old model
QString table_name = ui->comboBox_table_name->currentText(); QString table_name = ui->comboBox_table_name->currentText();
emit selectTable(table_name); emit selectTable(table_name);

View File

@ -522,7 +522,29 @@
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="4"> <item row="1" column="0" colspan="4">
<widget class="QTableView" name="tableView_database_table"/> <widget class="QTableView" name="tableView_database_table">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>