diff options
| author | nixo <nicolo@nixo.xyz> | 2020-10-31 16:29:46 +0100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2020-11-01 09:32:55 +0100 |
| commit | e159548fc99d2c611da98d930e8c7885e97d11ed (patch) | |
| tree | 008880842320814a0a283dca76c2f23002e1d4da /src/mainwindow.cpp | |
| parent | d3931529ccca3edcdb3fa9f0322a8c4352f2f476 (diff) | |
| download | kristall-e159548fc99d2c611da98d930e8c7885e97d11ed.tar.gz | |
Switch between tabs with Alt-N
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ee79efa..706394e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -73,6 +73,22 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : connect(sc, &QShortcut::activated, this, &MainWindow::on_focus_inputbar); } + { + std::string prefix = "Alt+"; + for (char tab = '0'; tab <= '9'; ++tab) { + std::string shortcut = prefix + tab; + QShortcut * sc = new QShortcut(QKeySequence(shortcut.c_str()), this); + connect(sc, &QShortcut::activated, this, + [this, tab](){ + // 1-9 goes from the first to the n-th tab, 0 goes to the last one + this->ui->browser_tabs-> + setCurrentIndex((tab == '0' ? + this->ui->browser_tabs->count() + : tab-'0') - 1); + }); + } + } + this->ui->favourites_view->setContextMenuPolicy(Qt::CustomContextMenu); this->ui->history_view->setContextMenuPolicy(Qt::CustomContextMenu); } |
