Add keyboard shortcuts for switching the currently browsed table

Add two new keyboard shortcuts for switching the currently selected
table in the Browse Data tab. These work as long as the table widget is
active. For now I have set them to Ctrl+PageUp and Ctrl+PageDown.

See issue #536.
This commit is contained in:
Martin Kleusberg
2017-02-02 22:07:49 +01:00
parent bf5ab01d7f
commit c62d291042
3 changed files with 23 additions and 3 deletions

View File

@@ -300,9 +300,8 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event)
{
copy();
return;
// Call a custom paste method when Ctrl-P is pressed
} else if(event->matches(QKeySequence::Paste))
{
} else if(event->matches(QKeySequence::Paste)) {
// Call a custom paste method when Ctrl-P is pressed
paste();
} else if(event->key() == Qt::Key_Tab && hasFocus() &&
selectedIndexes().count() == 1 &&
@@ -320,6 +319,10 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event)
foreach(const QModelIndex& index, selectedIndexes())
model()->setData(index, "");
}
} else if(event->modifiers().testFlag(Qt::ControlModifier) && (event->key() == Qt::Key_PageUp || event->key() == Qt::Key_PageDown)) {
// When pressing Ctrl + Page up/down send a signal indicating the user wants to change the current table
emit switchTable(event->key() == Qt::Key_PageDown);
return;
}
// This prevents the current selection from being changed when pressing tab to move to the next filter. Note that this is in an 'if' condition,