mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 00:14:06 +00:00
Close popup menus when ScanPopup window closes
This commit is contained in:
parent
831d46a6d3
commit
e00415e4d2
|
@ -941,7 +941,6 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
|
||||
QMenu menu( this );
|
||||
|
||||
|
||||
QAction * followLink = 0;
|
||||
QAction * followLinkExternal = 0;
|
||||
QAction * followLinkNewTab = 0;
|
||||
|
@ -1086,6 +1085,7 @@ void ArticleView::contextMenuRequested( QPoint const & pos )
|
|||
|
||||
if ( !menu.isEmpty() )
|
||||
{
|
||||
connect( this, SIGNAL( closePopupMenu() ), &menu, SLOT( close() ) );
|
||||
QAction * result = menu.exec( ui.definition->mapToGlobal( pos ) );
|
||||
|
||||
if ( !result )
|
||||
|
@ -1397,6 +1397,11 @@ void ArticleView::onJsActiveArticleChanged(QString const & id)
|
|||
emit activeArticleChanged( id.mid( 7 ) );
|
||||
}
|
||||
|
||||
void ArticleView::closeMenu()
|
||||
{
|
||||
emit closePopupMenu();
|
||||
}
|
||||
|
||||
void ArticleView::doubleClicked()
|
||||
{
|
||||
// We might want to initiate translation of the selected word
|
||||
|
|
|
@ -192,12 +192,18 @@ signals:
|
|||
/// Signal to add word to history even if history is disabled
|
||||
void forceAddWordToHistory( const QString & word);
|
||||
|
||||
/// Signal to close popup menu
|
||||
void closePopupMenu();
|
||||
|
||||
public slots:
|
||||
|
||||
void on_searchPrevious_clicked();
|
||||
void on_searchNext_clicked();
|
||||
void onJsActiveArticleChanged(QString const & id);
|
||||
|
||||
/// Receive signal from ScanPopup to close context menu
|
||||
void closeMenu();
|
||||
|
||||
private slots:
|
||||
|
||||
void loadFinished( bool ok );
|
||||
|
|
|
@ -636,6 +636,8 @@ void ScanPopup::on_wordListButton_clicked()
|
|||
menu.addAction( results[ x ].first );
|
||||
}
|
||||
|
||||
connect( this, SIGNAL( closeMenu() ), &menu, SLOT( close() ) );
|
||||
|
||||
QAction * result = menu.exec( mapToGlobal( ui.wordListButton->pos() ) +
|
||||
QPoint( 0, ui.wordListButton->height() ) );
|
||||
|
||||
|
@ -731,6 +733,7 @@ void ScanPopup::hideWindow()
|
|||
{
|
||||
uninterceptMouse();
|
||||
|
||||
emit closeMenu();
|
||||
hideTimer.stop();
|
||||
unsetCursor();
|
||||
hide();
|
||||
|
|
|
@ -51,6 +51,8 @@ signals:
|
|||
void editGroupRequested( unsigned id );
|
||||
/// Send word to main window
|
||||
void sendWordToMainWindow( QString const & word );
|
||||
/// Close opened menus when window hide
|
||||
void closeMenu();
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
Loading…
Reference in a new issue