diff --git a/fulltextsearch.cc b/fulltextsearch.cc index c1a704bb..1a2941d2 100644 --- a/fulltextsearch.cc +++ b/fulltextsearch.cc @@ -189,6 +189,8 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent, connect( ui.OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( ui.cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) ); + ui.headwordsView->installEventFilter( this ); + delegate = new WordListItemDelegate( ui.headwordsView->itemDelegate() ); if( delegate ) ui.headwordsView->setItemDelegate( delegate ); @@ -455,6 +457,20 @@ void FullTextSearchDialog::updateDictionaries() showDictNumbers(); } +bool FullTextSearchDialog::eventFilter( QObject * obj, QEvent * ev ) +{ + if( obj == ui.headwordsView && ev->type() == QEvent::KeyPress ) + { + QKeyEvent * kev = static_cast< QKeyEvent * >( ev ); + if( kev->key() == Qt::Key_Return || kev->key() == Qt::Key_Enter ) + { + itemClicked( ui.headwordsView->currentIndex() ); + return true; + } + } + return QDialog::eventFilter( obj, ev ); +} + /// HeadwordsListModel int HeadwordsListModel::rowCount( QModelIndex const & ) const diff --git a/fulltextsearch.hh b/fulltextsearch.hh index 55993824..6f5b27ad 100644 --- a/fulltextsearch.hh +++ b/fulltextsearch.hh @@ -192,6 +192,9 @@ public: void stopSearch(); +protected: + bool eventFilter( QObject * obj, QEvent * ev ); + private: Ui::FullTextSearchDialog ui; QList< FtsHeadword > results; diff --git a/mainwindow.cc b/mainwindow.cc index 84f12a52..58b38b78 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -4001,7 +4001,10 @@ void MainWindow::showFullTextSearchDialog() : groupInstances[ groupList->currentIndex() ].id; ftsDlg->setCurrentGroup( group ); - ftsDlg->show(); + if( !ftsDlg ->isVisible() ) + ftsDlg->show(); + else + ftsDlg->activateWindow(); } void MainWindow::closeFullTextSearchDialog()