1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

VerticalTabs: Also override Ctrl+PgUp/PgDown shortcuts

This commit is contained in:
David Rosca 2019-04-20 19:26:00 +02:00
parent 514097ef4c
commit 92721449c0
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -56,18 +56,53 @@ QWidget *VerticalTabsController::createSideBarWidget(BrowserWindow *window)
bool VerticalTabsController::handleKeyPress(QKeyEvent *event, TabWidget *tabWidget)
{
if (event->key() == Qt::Key_Tab && event->modifiers() == Qt::ControlModifier) {
auto switchToNextTab = [=]() {
VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow());
if (widget) {
widget->switchToNextTab();
return true;
}
} else if (event->key() == Qt::Key_Backtab && event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
return false;
};
auto switchToPreviousTab = [=]() {
VerticalTabsWidget *widget = m_widgets.value(tabWidget->browserWindow());
if (widget) {
widget->switchToPreviousTab();
return true;
}
return false;
};
switch (event->key()) {
case Qt::Key_Tab:
case Qt::Key_PageDown:
if (event->modifiers() == Qt::ControlModifier) {
if (switchToNextTab()) {
return true;
}
}
break;
case Qt::Key_Backtab:
if (event->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) {
if (switchToPreviousTab()) {
return true;
}
}
break;
case Qt::Key_PageUp:
if (event->modifiers() == Qt::ControlModifier) {
if (switchToPreviousTab()) {
return true;
}
}
break;
default:
break;
}
return false;
}