mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
fix: set shortcut context (#1644)
* fix: work around to fix ctrl+F in macos popup
This commit is contained in:
parent
456f7f1aaf
commit
c4fa9b44e5
|
@ -1774,7 +1774,16 @@ ArticleView * MainWindow::createNewTab( bool switchToIt, QString const & name )
|
|||
connect( view, &ArticleView::zoomOut, this, &MainWindow::zoomout );
|
||||
connect( view, &ArticleView::saveBookmarkSignal, this, &MainWindow::addBookmarkToFavorite );
|
||||
|
||||
connect( ui.searchInPageAction, &QAction::triggered, view, &ArticleView::openSearch );
|
||||
connect( ui.searchInPageAction, &QAction::triggered, this, [ this, view ]() {
|
||||
#ifdef Q_OS_MACOS
|
||||
//workaround to fix macos popup page search Ctrl + F
|
||||
if ( scanPopup && scanPopup->isActiveWindow() ) {
|
||||
scanPopup->openSearch();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
view->openSearch();
|
||||
} );
|
||||
|
||||
view->setSelectionBySingleClick( cfg.preferences.selectWordBySingleClick );
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ ScanPopup::ScanPopup( QWidget * parent,
|
|||
connect( definition, &ArticleView::typingEvent, this, &ScanPopup::typingEvent );
|
||||
|
||||
openSearchAction.setShortcut( QKeySequence( "Ctrl+F" ) );
|
||||
openSearchAction.setShortcutContext( Qt::WidgetWithChildrenShortcut );
|
||||
addAction( &openSearchAction );
|
||||
connect( &openSearchAction, &QAction::triggered, definition, &ArticleView::openSearch );
|
||||
|
||||
|
@ -1126,6 +1127,11 @@ void ScanPopup::setGroupByName( QString const & name ) const
|
|||
gdWarning( "Group \"%s\" for popup window is not found\n", name.toUtf8().data() );
|
||||
}
|
||||
|
||||
void ScanPopup::openSearch()
|
||||
{
|
||||
definition->openSearch();
|
||||
}
|
||||
|
||||
void ScanPopup::alwaysOnTopClicked( bool checked )
|
||||
{
|
||||
bool wasVisible = isVisible();
|
||||
|
|
|
@ -81,7 +81,6 @@ signals:
|
|||
/// Put translated word into Favorites
|
||||
void sendWordToFavorites( QString const & word, unsigned groupId, bool );
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
/// Ask for source window is current translate tab
|
||||
bool isGoldenDictWindow( HWND hwnd );
|
||||
|
@ -102,6 +101,8 @@ public slots:
|
|||
#ifdef HAVE_X11
|
||||
void showEngagePopup();
|
||||
#endif
|
||||
void openSearch();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in a new issue