From 0317050fe6434918b397674d82a5cfbfaaec9297 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 19 Feb 2010 13:00:07 +0000 Subject: Enter -> tab in lineedit. --- client/widgets/lineedit.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'client/widgets/lineedit.cc') 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 +bool LineEdit::eventFilter(QObject *, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) { + QKeyEvent *keyEvent = static_cast(event); + if(keyEvent->key() == Qt::Key_Return) { + QKeyEvent tabevent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier); + QCoreApplication::sendEvent(this, &tabevent); + } + } + return false; +} -- cgit v1.2.3