fix: Workaround to select all rows

This commit is contained in:
Lars Toenning
2024-11-23 15:35:35 +01:00
parent 733ceff368
commit e97c2db821
2 changed files with 15 additions and 0 deletions

View File

@@ -519,6 +519,9 @@ namespace swift::gui
//! Settings have been changed
void settingsChanged();
//! Select all rows
void selectAll() override;
//! @{
//! Change selection modes
void setMultiSelection();

View File

@@ -877,6 +877,18 @@ namespace swift::gui::views
m_displayAutomatically = a->isChecked();
}
void CViewBaseNonTemplate::selectAll()
{
// FIXME: Workaround to implement the logic on our own because the default selectAll() implementation does not
// seem to work
this->clearSelection();
QItemSelection selectedItems;
const int columns = this->model()->columnCount() - 1;
const int rows = this->model()->rowCount() - 1;
selectedItems.select(this->model()->index(0, 0), this->model()->index(rows, columns));
this->selectionModel()->select(selectedItems, QItemSelectionModel::Select);
}
void CViewBaseNonTemplate::setSingleSelection() { this->setSelectionMode(SingleSelection); }
void CViewBaseNonTemplate::setExtendedSelection()