diff options
author | deva <deva> | 2010-02-19 13:00:07 +0000 |
---|---|---|
committer | deva <deva> | 2010-02-19 13:00:07 +0000 |
commit | 0317050fe6434918b397674d82a5cfbfaaec9297 (patch) | |
tree | 9a1fbed0a5deb0a0813f6aee4d99563d98da6a3e /client/widgets | |
parent | bbf6aeccbd2054063c2c2bfe080b37ea9d993462 (diff) |
Enter -> tab in lineedit.
Diffstat (limited to 'client/widgets')
-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__*/ |