Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/logwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,18 @@
void LogWindow::refresh()
{
//qDebug() << Q_FUNC_INFO << " - Start";
// Re-apply the view's current sort indicator to the model before selecting.
// LogModel::setColumns() (called whenever columns are reconfigured, e.g. when
// the settings dialog is shown) resets the model's ORDER BY to "id ASC".
// If the log did not change, createlogPanel() is not re-run, so the sort is
// never restored — the next select() would return rows in the wrong order,
// placing newly saved QSOs at the bottom instead of the top.
// The header's sort indicator is not affected by setColumns(), so it always
// reflects the last sort the user (or createlogPanel) requested.
int sortSection = logView->horizontalHeader()->sortIndicatorSection();
if (sortSection >= 0)

Check warning on line 277 in src/logwindow.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the init-statement to declare "sortSection" inside the if statement.

See more on https://sonarcloud.io/project/issues?id=ea4k_klog&issues=AZ2Qqt9luFuRfQvP4kYu&open=AZ2Qqt9luFuRfQvP4kYu&pullRequest=989
logModel->setSort(sortSection, logView->horizontalHeader()->sortIndicatorOrder());

if (!logModel->select())
{
//qDebug() << Q_FUNC_INFO << " - ERROR on select()";
Expand Down