Skip to content
Snippets Groups Projects
Commit 13870830 authored by stefan's avatar stefan
Browse files

QueryDialog, pressing Ctrl+Enter accepts the dialog

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1831 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 9787231d
No related branches found
No related tags found
No related merge requests found
...@@ -18,11 +18,14 @@ ...@@ -18,11 +18,14 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#include "query_dialog.hh" #include "query_dialog.hh"
#include <ost/mol/query.hh>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QKeyEvent>
#include <iostream>
#include <ost/mol/query.hh>
namespace ost { namespace gui { namespace ost { namespace gui {
...@@ -92,4 +95,11 @@ QString QueryDialog::GetQueryString() const ...@@ -92,4 +95,11 @@ QString QueryDialog::GetQueryString() const
{ {
return edit_->toPlainText(); return edit_->toPlainText();
} }
void QueryDialog::keyPressEvent(QKeyEvent* event){
if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
this->accept();
}
}
}} }}
...@@ -37,8 +37,13 @@ class DLLEXPORT_OST_GUI QueryDialog : public QDialog { ...@@ -37,8 +37,13 @@ class DLLEXPORT_OST_GUI QueryDialog : public QDialog {
public: public:
QueryDialog(QWidget* parent=NULL); QueryDialog(QWidget* parent=NULL);
QString GetQueryString() const; QString GetQueryString() const;
public slots: public slots:
void OnTextChanged(); void OnTextChanged();
protected:
virtual void keyPressEvent(QKeyEvent* event);
private: private:
void Colorize(); void Colorize();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment