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.
This commit is contained in:
Martin Kleusberg
2013-01-05 16:08:33 +01:00
parent bed67cd970
commit acfb40902a

View File

@@ -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)){