Skip to content

Commit

Permalink
Fix table view after unlocking view editing
Browse files Browse the repository at this point in the history
  • Loading branch information
MKleusberg committed Jun 7, 2018
1 parent 6466aac commit 72506fb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1626,7 +1626,6 @@ void MainWindow::enableEditing(bool enable_edit, bool enable_insertdelete)
ui->buttonNewRecord->setEnabled(insertdelete);
ui->buttonDeleteRecord->setEnabled(insertdelete);
ui->dataTable->setEditTriggers(edit ? QAbstractItemView::SelectedClicked | QAbstractItemView::AnyKeyPressed | QAbstractItemView::EditKeyPressed : QAbstractItemView::NoEditTriggers);

}

void MainWindow::browseTableHeaderClicked(int logicalindex)
Expand All @@ -1647,7 +1646,7 @@ void MainWindow::browseTableHeaderClicked(int logicalindex)

attachPlot(ui->dataTable, m_browseTableModel, &browseTableSettings[currentlyBrowsedTableName()]);

// This seems to be necessary as a workaround for newer Qt versions. Otherwise the rowid column is always shown after changing the filters.
// This seems to be necessary as a workaround for newer Qt versions. Otherwise the rowid column is always shown after changing the data view.
bool showRowid = browseTableSettings[currentlyBrowsedTableName()].showRowid;
ui->dataTable->setColumnHidden(0, !showRowid);
}
Expand Down Expand Up @@ -2481,7 +2480,7 @@ void MainWindow::updateFilter(int column, const QString& value)
browseTableSettings[currentlyBrowsedTableName()].filterValues[column] = value;
setRecordsetLabel();

// This seems to be necessary as a workaround for newer Qt versions. Otherwise the rowid column is always shown after changing the filters.
// This seems to be necessary as a workaround for newer Qt versions. Otherwise the rowid column is always shown after changing the data view.
bool showRowid = browseTableSettings[currentlyBrowsedTableName()].showRowid;
ui->dataTable->setColumnHidden(0, !showRowid);
}
Expand Down Expand Up @@ -2833,6 +2832,10 @@ void MainWindow::unlockViewEditing(bool unlock, QString pk)

// Save settings for this table
browseTableSettings[currentTable].unlockViewPk = pk;

// This seems to be necessary as a workaround for newer Qt versions. Otherwise the rowid column is always shown after changing the data view.
bool showRowid = browseTableSettings[currentlyBrowsedTableName()].showRowid;
ui->dataTable->setColumnHidden(0, !showRowid);
}

sqlb::ObjectIdentifier MainWindow::currentlyBrowsedTableName() const
Expand Down

0 comments on commit 72506fb

Please sign in to comment.