mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-07-26 08:15:32 -04:00
Maintain selected sort option when toggling filters
This commit is contained in:
parent
64078933ab
commit
7a5cd6105c
1 changed files with 10 additions and 1 deletions
|
@ -238,6 +238,8 @@ void ReportsWidgetHealthcheck::loadSettings(QSharedPointer<Database> db)
|
||||||
auto row = QList<QStandardItem*>();
|
auto row = QList<QStandardItem*>();
|
||||||
row << new QStandardItem(tr("Please wait, health data is being calculated…"));
|
row << new QStandardItem(tr("Please wait, health data is being calculated…"));
|
||||||
m_referencesModel->appendRow(row);
|
m_referencesModel->appendRow(row);
|
||||||
|
// Default sort by first column (health score)
|
||||||
|
m_ui->healthcheckTableView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReportsWidgetHealthcheck::showEvent(QShowEvent* event)
|
void ReportsWidgetHealthcheck::showEvent(QShowEvent* event)
|
||||||
|
@ -253,6 +255,11 @@ void ReportsWidgetHealthcheck::showEvent(QShowEvent* event)
|
||||||
|
|
||||||
void ReportsWidgetHealthcheck::calculateHealth()
|
void ReportsWidgetHealthcheck::calculateHealth()
|
||||||
{
|
{
|
||||||
|
// Save current sort order before clearing the model so we can restore it later
|
||||||
|
int sortColumn = m_ui->healthcheckTableView->horizontalHeader()->sortIndicatorSection();
|
||||||
|
Qt::SortOrder sortOrder = m_ui->healthcheckTableView->horizontalHeader()->sortIndicatorOrder();
|
||||||
|
|
||||||
|
// Safe to clear
|
||||||
m_referencesModel->clear();
|
m_referencesModel->clear();
|
||||||
|
|
||||||
// Perform the health check
|
// Perform the health check
|
||||||
|
@ -277,9 +284,11 @@ void ReportsWidgetHealthcheck::calculateHealth()
|
||||||
} else {
|
} else {
|
||||||
m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("") << tr("Title") << tr("Path") << tr("Score")
|
m_referencesModel->setHorizontalHeaderLabels(QStringList() << tr("") << tr("Title") << tr("Path") << tr("Score")
|
||||||
<< tr("Reason"));
|
<< tr("Reason"));
|
||||||
m_ui->healthcheckTableView->sortByColumn(0, Qt::AscendingOrder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore sorting options that was stored before the model was cleared
|
||||||
|
m_ui->healthcheckTableView->sortByColumn(sortColumn, sortOrder);
|
||||||
|
|
||||||
m_ui->healthcheckTableView->resizeColumnsToContents();
|
m_ui->healthcheckTableView->resizeColumnsToContents();
|
||||||
m_ui->healthcheckTableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
m_ui->healthcheckTableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue