diff options
-rw-r--r-- | client/widgets/lineedit.cc | 16 | ||||
-rw-r--r-- | client/widgets/lineedit.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc index 49b3704..7c2558b 100644 --- a/client/widgets/lineedit.cc +++ b/client/widgets/lineedit.cc @@ -48,6 +48,8 @@ LineEdit::LineEdit(QDomNode &node, MacroWindow *macrowindow) connect(this, SIGNAL(textChanged(QString)), this, SLOT(changed())); connect(this, SIGNAL(textEdited(QString)), this, SLOT(user_changed())); + + installEventFilter(this); // Detect keyboard input. } void LineEdit::changed() @@ -127,3 +129,17 @@ void LineEdit::setVisibility(bool visible) { setVisible(visible); } + + +#include <QCoreApplication> +bool LineEdit::eventFilter(QObject *, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); + if(keyEvent->key() == Qt::Key_Return) { + QKeyEvent tabevent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier); + QCoreApplication::sendEvent(this, &tabevent); + } + } + return false; +} diff --git a/client/widgets/lineedit.h b/client/widgets/lineedit.h index 5af912f..c8ba808 100644 --- a/client/widgets/lineedit.h +++ b/client/widgets/lineedit.h @@ -60,6 +60,9 @@ public slots: signals: void wasChanged(); + +private: + bool eventFilter(QObject *, QEvent *event); }; #endif/*__PRACRO_LINEEDIT_H__*/ |