Rectify the sort indicator after multiple column selection

When more than one column is selected we abort the sorting, but Qt has
already assigned the sort indicator to the last selected column, so we
have to restore the saved settings to fix the sort indicator column.

See issue #1717
This commit is contained in:
mgrojo
2019-01-26 20:51:02 +01:00
parent e22966ec23
commit 03e75af3f1

View File

@@ -2009,12 +2009,15 @@ void MainWindow::enableEditing(bool enable_edit)
void MainWindow::browseTableHeaderClicked(int logicalindex)
{
// Abort if there is more than one column selected because this tells us that the user pretty sure wants to do a range selection instead of sorting data
if(ui->dataTable->selectionModel()->selectedColumns().count() > 1)
return;
// instead of the column name we just use the column index, +2 because 'rowid, *' is the projection
BrowseDataTableSettings& settings = browseTableSettings[currentlyBrowsedTableName()];
// Abort if there is more than one column selected because this tells us that the user pretty sure wants to do a range selection
// instead of sorting data. But restore before the sort indicator automatically changed by Qt so it still indicates the last
// use sort action.
if(ui->dataTable->selectionModel()->selectedColumns().count() > 1) {
applyBrowseTableSettings(settings);
return;
}
int dummy;
Qt::SortOrder order;
fromSortOrderVector(settings.query.orderBy(), dummy, order);