diff --git a/widgets/lineedit.cpp b/widgets/lineedit.cpp index 09c0c66ef..9842379b2 100644 --- a/widgets/lineedit.cpp +++ b/widgets/lineedit.cpp @@ -189,6 +189,8 @@ void LineEdit::focusInEvent(QFocusEvent *event) // as of Qt 4.7, apparently we have a bug here in QGraphicsProxyWidget nativeWidget()->setFocus(event->reason()); } + + emit focusChanged(true); } void LineEdit::focusOutEvent(QFocusEvent *event) @@ -215,6 +217,8 @@ void LineEdit::focusOutEvent(QFocusEvent *event) } QGraphicsProxyWidget::focusOutEvent(event); + + emit focusChanged(false); } } // namespace Plasma diff --git a/widgets/lineedit.h b/widgets/lineedit.h index 41fcf3928..a0df163c0 100644 --- a/widgets/lineedit.h +++ b/widgets/lineedit.h @@ -133,6 +133,11 @@ Q_SIGNALS: * @since 4.4 */ void textChanged(const QString &text); + /** + * Emitted when the widget receives or loses focus + * @since 4.7 + */ + void focusChanged(bool focused); private: Q_PRIVATE_SLOT(d, void setPalette())