From acfb40902a76522b3f555c43b8b2867c6f5dd3b1 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Sat, 5 Jan 2013 16:08:33 +0100 Subject: [PATCH] Reset sorting when changing the current table Reset the sorting of the table view in the browse tab when changing the current table. This offers not just only a more plausible behaviour to the user but also fixes a bug that would cause an empty table to be shown when sorting e.g. column number 5 and then changing to a table with just 2 columns. --- src/MainWindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index ba682039..be0bc110 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -208,7 +208,11 @@ void MainWindow::populateTable( const QString & tablename, bool keepColumnWidths bool mustreset = false; QApplication::setOverrideCursor( Qt::WaitCursor ); if (tablename.compare(db.curBrowseTableName)!=0) + { mustreset = true; + curBrowseOrderByIndex = 1; + curBrowseOrderByMode = ORDERMODE_ASC; + } QString orderby = QString::number(curBrowseOrderByIndex) + " " + (curBrowseOrderByMode == ORDERMODE_ASC ? "ASC" : "DESC"); if (!db.browseTable(tablename, orderby)){