From a6aecaaa63037023e027f1273f99375f5067638c Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Wed, 27 Jan 2021 20:25:15 +0100 Subject: Use PageUp/Down to switch between tabs --- src/mainwindow.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d1f27d7..d656867 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -91,6 +91,34 @@ MainWindow::MainWindow(QApplication * app, QWidget *parent) : } } + { + QShortcut * sc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageDown), this); + connect(sc, &QShortcut::activated, this, [this](){ + int i = this->ui->browser_tabs->currentIndex(); + + if (i + 1 >= this->ui->browser_tabs->count()) + i = 0; + else + i++; + + this->ui->browser_tabs->setCurrentIndex(i); + }); + } + + { + QShortcut * sc = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_PageUp), this); + connect(sc, &QShortcut::activated, this, [this](){ + int i = this->ui->browser_tabs->currentIndex(); + + if (!i) + i = this->ui->browser_tabs->count() - 1; + else + i--; + + this->ui->browser_tabs->setCurrentIndex(i); + }); + } + this->ui->favourites_view->setContextMenuPolicy(Qt::CustomContextMenu); this->ui->history_view->setContextMenuPolicy(Qt::CustomContextMenu); -- cgit v1.2.3