diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 5c3ac1242..204d565fe 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -1651,13 +1651,29 @@ void QupZilla::keyPressEvent(QKeyEvent* event) case Qt::Key_Tab: if (event->modifiers() == Qt::ControlModifier) { - m_tabWidget->createKeyPressEvent(event); + m_tabWidget->nextTab(); + event->accept(); } break; case Qt::Key_Backtab: if (event->modifiers() == (Qt::ControlModifier + Qt::ShiftModifier)) { - m_tabWidget->createKeyPressEvent(event); + m_tabWidget->previousTab(); + event->accept(); + } + break; + + case Qt::Key_PageDown: + if (event->modifiers() == Qt::ControlModifier) { + m_tabWidget->nextTab(); + event->accept(); + } + break; + + case Qt::Key_PageUp: + if (event->modifiers() == Qt::ControlModifier) { + m_tabWidget->previousTab(); + event->accept(); } break; diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index c9ccaba1b..b74473a66 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -159,11 +159,6 @@ WebTab* TabWidget::weTab(int index) return qobject_cast(widget(index)); } -void TabWidget::createKeyPressEvent(QKeyEvent* event) -{ - QTabWidget::keyPressEvent(event); -} - void TabWidget::showButtons() { m_buttonListTabs->show(); @@ -472,6 +467,18 @@ void TabWidget::setTabText(int index, const QString &text) QTabWidget::setTabText(index, newtext); } +void TabWidget::nextTab() +{ + QKeyEvent fakeEvent(QKeyEvent::KeyPress, Qt::Key_Tab, Qt::ControlModifier); + keyPressEvent(&fakeEvent); +} + +void TabWidget::previousTab() +{ + QKeyEvent fakeEvent(QKeyEvent::KeyPress, Qt::Key_Backtab, QFlags(Qt::ControlModifier + Qt::ShiftModifier)); + keyPressEvent(&fakeEvent); +} + void TabWidget::reloadTab(int index) { weTab(index)->reload(); diff --git a/src/lib/webview/tabwidget.h b/src/lib/webview/tabwidget.h index 6c8fdfcb8..3cacc7f06 100644 --- a/src/lib/webview/tabwidget.h +++ b/src/lib/webview/tabwidget.h @@ -69,17 +69,19 @@ public: void setTabIcon(int index, const QIcon &icon); void setTabText(int index, const QString &text); - inline TabBar* getTabBar() { return m_tabBar; } - inline ClosedTabsManager* closedTabsManager() { return m_closedTabsManager; } + void nextTab(); + void previousTab(); + + void showTabBar(); + + TabBar* getTabBar() { return m_tabBar; } + ClosedTabsManager* closedTabsManager() { return m_closedTabsManager; } bool canRestoreTab(); QList allTabs(bool withPinned = true); QStackedWidget* locationBars() { return m_locationBars; } ToolButton* buttonListTabs() { return m_buttonListTabs; } AddTabButton* buttonAddTab() { return m_buttonAddTab; } - void createKeyPressEvent(QKeyEvent* event); - void showTabBar(); - void disconnectObjects(); signals: