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

@@ -225,6 +225,22 @@ void MainWindow::init()
connect(ui->dockEdit, SIGNAL(visibilityChanged(bool)), this, SLOT(toggleEditDock(bool)));
connect(&m_remoteDb, SIGNAL(openFile(QString)), this, SLOT(fileOpen(QString)));
// Lambda function for keyboard shortcuts for selecting next/previous table in Browse Data tab
connect(ui->dataTable, &ExtendedTableWidget::switchTable, [this](bool next) {
int index = ui->comboBrowseTable->currentIndex();
int num_items = ui->comboBrowseTable->count();
if(next)
{
if(++index >= num_items)
index = 0;
} else {
if(--index < 0)
index = num_items - 1;
}
ui->comboBrowseTable->setCurrentIndex(index);
populateTable();
});
// Set other window settings
setAcceptDrops(true);
setWindowTitle(QApplication::applicationName());