1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

BrowserWindow: Make Ctrl+PgUp/Down shortcuts use tab bar order

This commit is contained in:
David Rosca 2018-02-06 15:00:49 +01:00
parent beeb68f7a6
commit 6c94d40187
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 4 additions and 8 deletions

View File

@ -1344,15 +1344,13 @@ void BrowserWindow::keyPressEvent(QKeyEvent* event)
case Qt::Key_Tab: case Qt::Key_Tab:
if (event->modifiers() == Qt::ControlModifier) { if (event->modifiers() == Qt::ControlModifier) {
m_tabWidget->nextTab(); QApplication::sendEvent(m_tabWidget, event);
event->accept();
} }
break; break;
case Qt::Key_Backtab: case Qt::Key_Backtab:
if (event->modifiers() == (Qt::ControlModifier + Qt::ShiftModifier)) { if (event->modifiers() == (Qt::ControlModifier + Qt::ShiftModifier)) {
m_tabWidget->previousTab(); QApplication::sendEvent(m_tabWidget, event);
event->accept();
} }
break; break;

View File

@ -538,14 +538,12 @@ void TabWidget::setCurrentIndex(int index)
void TabWidget::nextTab() void TabWidget::nextTab()
{ {
QKeyEvent fakeEvent(QKeyEvent::KeyPress, Qt::Key_Tab, Qt::ControlModifier); setCurrentIndex((currentIndex() + 1) % count());
keyPressEvent(&fakeEvent);
} }
void TabWidget::previousTab() void TabWidget::previousTab()
{ {
QKeyEvent fakeEvent(QKeyEvent::KeyPress, Qt::Key_Backtab, QFlags<Qt::KeyboardModifier>(Qt::ControlModifier + Qt::ShiftModifier)); setCurrentIndex(currentIndex() == 0 ? count() - 1 : currentIndex() - 1);
keyPressEvent(&fakeEvent);
} }
int TabWidget::normalTabsCount() const int TabWidget::normalTabsCount() const