mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
Make sure table widget shortcuts do not affect other parts of the UI
When handling the Ctrl+Space and Shift+Space keyboard shortcuts in ExtenededTableWidget, make sure to not do anything if there is 1) no table selection, or 2) if the table widget has no focus. See issue #2038.
This commit is contained in:
@@ -384,10 +384,14 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) :
|
||||
// Add spreadsheet shortcuts for selecting entire columns or entire rows.
|
||||
QShortcut* selectColumnShortcut = new QShortcut(QKeySequence("Ctrl+Space"), this);
|
||||
connect(selectColumnShortcut, &QShortcut::activated, [this]() {
|
||||
if(!hasFocus() || selectionModel()->selectedIndexes().isEmpty())
|
||||
return;
|
||||
selectionModel()->select(QItemSelection(selectionModel()->selectedIndexes().first(), selectionModel()->selectedIndexes().last()), QItemSelectionModel::Select | QItemSelectionModel::Columns);
|
||||
});
|
||||
QShortcut* selectRowShortcut = new QShortcut(QKeySequence("Shift+Space"), this);
|
||||
connect(selectRowShortcut, &QShortcut::activated, [this]() {
|
||||
if(!hasFocus() || selectionModel()->selectedIndexes().isEmpty())
|
||||
return;
|
||||
selectionModel()->select(QItemSelection(selectionModel()->selectedIndexes().first(), selectionModel()->selectedIndexes().last()), QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user