From aa02fdcc255ca9e31fda7d91c87e85e327487da2 Mon Sep 17 00:00:00 2001 From: Abs62 Date: Thu, 14 Jul 2022 18:14:28 +0300 Subject: [PATCH] A little more Ctrl+Tab/Ctrl+Shift+Tab handling --- mainwindow.cc | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 102b1963..b0ca85c3 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -726,6 +726,11 @@ MainWindow::MainWindow( Config::Class & cfg_ ): ui.historyList->installEventFilter( this ); + ui.favoritesTree->installEventFilter( this ); + + groupListInDock->installEventFilter( this ); + groupListInToolbar->installEventFilter( this ); + connect( &ftsIndexing, SIGNAL( newIndexingName( QString ) ), this, SLOT( showFTSIndexingName( QString ) ) ); #ifdef Q_OS_WIN @@ -2534,6 +2539,14 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev ) if (ev->type() == QEvent::KeyPress) { QKeyEvent *keyevent = static_cast(ev); + + bool handleCtrlTab = ( obj == translateLine + || obj == wordList + || obj == ui.historyList + || obj == ui.favoritesTree + || obj == ui.dictsList + || obj == groupList ); + if (keyevent->modifiers() == Qt::ControlModifier && keyevent->key() == Qt::Key_Tab) { if (cfg.preferences.mruTabOrder) @@ -2541,13 +2554,18 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev ) ctrlTabPressed(); return true; } - else if( obj == translateLine ) + else if( handleCtrlTab ) { QApplication::sendEvent( ui.tabWidget, ev ); return true; } return false; } + if( handleCtrlTab && keyevent->matches( QKeySequence::PreviousChild ) ) // Handle only Ctrl+Shist+Tab here because Ctrl+Tab was already handled before + { + QApplication::sendEvent( ui.tabWidget, ev ); + return true; + } } if ( obj == translateLine ) @@ -2566,11 +2584,6 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev ) } } - if( keyEvent->matches( QKeySequence::PreviousChild ) ) // Handle only Ctrl+Shist+Tab because Ctrl+Tab was already handled before - { - QApplication::sendEvent( ui.tabWidget, ev ); - return true; - } } if ( ev->type() == QEvent::FocusIn ) {