diff --git a/src/ui/mainwindow.cc b/src/ui/mainwindow.cc index c37ef5df..5f22c249 100644 --- a/src/ui/mainwindow.cc +++ b/src/ui/mainwindow.cc @@ -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 ); diff --git a/src/ui/scanpopup.cc b/src/ui/scanpopup.cc index b649f872..01e49e11 100644 --- a/src/ui/scanpopup.cc +++ b/src/ui/scanpopup.cc @@ -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(); diff --git a/src/ui/scanpopup.hh b/src/ui/scanpopup.hh index aa26b762..adcaa0ad 100644 --- a/src/ui/scanpopup.hh +++ b/src/ui/scanpopup.hh @@ -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: