diff --git a/src/frontends/qt2/QCommandBuffer.C b/src/frontends/qt2/QCommandBuffer.C index 98b1273bc2..e467dd1025 100644 --- a/src/frontends/qt2/QCommandBuffer.C +++ b/src/frontends/qt2/QCommandBuffer.C @@ -28,6 +28,7 @@ #include "LString.h" using std::vector; +using std::endl; namespace { diff --git a/src/frontends/qt2/QCommandEdit.C b/src/frontends/qt2/QCommandEdit.C index 1f95eeaa8f..4c51f615ce 100644 --- a/src/frontends/qt2/QCommandEdit.C +++ b/src/frontends/qt2/QCommandEdit.C @@ -41,12 +41,16 @@ void QCommandEdit::keyPressEvent(QKeyEvent * e) } -void QCommandEdit::focusOutEvent(QFocusEvent * e) +bool QCommandEdit::event(QEvent * e) { - if (e->reason() == QFocusEvent::Tab) { - emit tabPressed(); - return; - } + if (e->type() != QEvent::KeyPress) + return QLineEdit::event(e); - QLineEdit::focusOutEvent(e); + QKeyEvent * ev = (QKeyEvent *)e; + + if (ev->key() != Key_Tab) + return QLineEdit::event(e); + + emit tabPressed(); + return true; } diff --git a/src/frontends/qt2/QCommandEdit.h b/src/frontends/qt2/QCommandEdit.h index 2096dc7c01..0c8d420bb5 100644 --- a/src/frontends/qt2/QCommandEdit.h +++ b/src/frontends/qt2/QCommandEdit.h @@ -32,9 +32,9 @@ signals: void tabPressed(); protected: - virtual void keyPressEvent(QKeyEvent * e); + virtual bool event(QEvent * e); - virtual void focusOutEvent(QFocusEvent * e); + virtual void keyPressEvent(QKeyEvent * e); }; #endif // QCOMMANDEDIT_H