focusChanged(bool) signal for LineEdit

This commit is contained in:
Sebastian Kügler 2011-08-29 21:09:08 +02:00
parent 02338c2bca
commit 98cb6e0a83
2 changed files with 9 additions and 0 deletions

View File

@ -189,6 +189,8 @@ void LineEdit::focusInEvent(QFocusEvent *event)
// as of Qt 4.7, apparently we have a bug here in QGraphicsProxyWidget // as of Qt 4.7, apparently we have a bug here in QGraphicsProxyWidget
nativeWidget()->setFocus(event->reason()); nativeWidget()->setFocus(event->reason());
} }
emit focusChanged(true);
} }
void LineEdit::focusOutEvent(QFocusEvent *event) void LineEdit::focusOutEvent(QFocusEvent *event)
@ -215,6 +217,8 @@ void LineEdit::focusOutEvent(QFocusEvent *event)
} }
QGraphicsProxyWidget::focusOutEvent(event); QGraphicsProxyWidget::focusOutEvent(event);
emit focusChanged(false);
} }
} // namespace Plasma } // namespace Plasma

View File

@ -133,6 +133,11 @@ Q_SIGNALS:
* @since 4.4 * @since 4.4
*/ */
void textChanged(const QString &text); void textChanged(const QString &text);
/**
* Emitted when the widget receives or loses focus
* @since 4.7
*/
void focusChanged(bool focused);
private: private:
Q_PRIVATE_SLOT(d, void setPalette()) Q_PRIVATE_SLOT(d, void setPalette())