Merge pull request #122 from xiaoyifang/staged

merge stage to dev
This commit is contained in:
xiaoyifang 2022-07-23 09:36:45 +08:00 committed by GitHub
commit dfbac9eefb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1034 additions and 697 deletions

File diff suppressed because it is too large Load diff

View file

@ -769,6 +769,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 ) ) );
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
@ -1574,7 +1579,7 @@ void MainWindow::createTabList()
tabListButton->setToolTip( tr( "Open Tabs List" ) ); tabListButton->setToolTip( tr( "Open Tabs List" ) );
tabListButton->setPopupMode(QToolButton::InstantPopup); tabListButton->setPopupMode(QToolButton::InstantPopup);
ui.tabWidget->setCornerWidget(tabListButton); ui.tabWidget->setCornerWidget(tabListButton);
tabListButton->setFocusPolicy(Qt::ClickFocus); tabListButton->setFocusPolicy(Qt::NoFocus);
} }
void MainWindow::fillWindowsMenu() void MainWindow::fillWindowsMenu()
@ -2543,6 +2548,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)
@ -2550,8 +2563,18 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
ctrlTabPressed(); ctrlTabPressed();
return true; return true;
} }
else if( handleCtrlTab )
{
QApplication::sendEvent( ui.tabWidget, ev );
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 )
@ -2569,6 +2592,7 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
return true; return true;
} }
} }
} }
if ( ev->type() == QEvent::FocusIn ) { if ( ev->type() == QEvent::FocusIn ) {