mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
fix: Workaround to select all rows
This commit is contained in:
@@ -519,6 +519,9 @@ namespace swift::gui
|
||||
//! Settings have been changed
|
||||
void settingsChanged();
|
||||
|
||||
//! Select all rows
|
||||
void selectAll() override;
|
||||
|
||||
//! @{
|
||||
//! Change selection modes
|
||||
void setMultiSelection();
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user