A little more Ctrl+Tab/Ctrl+Shift+Tab handling

This commit is contained in:
Abs62 2022-07-14 18:14:28 +03:00
parent 5c3b3b8718
commit aa02fdcc25

View file

@ -726,6 +726,11 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
ui.historyList->installEventFilter( this ); ui.historyList->installEventFilter( this );
ui.favoritesTree->installEventFilter( this );
groupListInDock->installEventFilter( this );
groupListInToolbar->installEventFilter( this );
connect( &ftsIndexing, SIGNAL( newIndexingName( QString ) ), this, SLOT( showFTSIndexingName( QString ) ) ); connect( &ftsIndexing, SIGNAL( newIndexingName( QString ) ), this, SLOT( showFTSIndexingName( QString ) ) );
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
@ -2534,6 +2539,14 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
if (ev->type() == QEvent::KeyPress) if (ev->type() == QEvent::KeyPress)
{ {
QKeyEvent *keyevent = static_cast<QKeyEvent*>(ev); QKeyEvent *keyevent = static_cast<QKeyEvent*>(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 (keyevent->modifiers() == Qt::ControlModifier && keyevent->key() == Qt::Key_Tab)
{ {
if (cfg.preferences.mruTabOrder) if (cfg.preferences.mruTabOrder)
@ -2541,13 +2554,18 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
ctrlTabPressed(); ctrlTabPressed();
return true; return true;
} }
else if( obj == translateLine ) else if( handleCtrlTab )
{ {
QApplication::sendEvent( ui.tabWidget, ev ); QApplication::sendEvent( ui.tabWidget, ev );
return true; return true;
} }
return false; 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 ) 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 ) { if ( ev->type() == QEvent::FocusIn ) {