diff options
author | Ian Walters <ian.walters@nokia.com> | 2009-05-07 05:10:57 (GMT) |
---|---|---|
committer | Ian Walters <ian.walters@nokia.com> | 2009-05-07 05:10:57 (GMT) |
commit | fe13d7b9ac373e959b8c6346fd7ec783855979d6 (patch) | |
tree | 378fd1bd1160a9bdcfb22fb53bf2cd434e0e2d44 /src/declarative/fx/qfxtextedit.cpp | |
parent | 9adf93e1a2906606b05c50395e411dad6bfb47ab (diff) | |
download | Qt-fe13d7b9ac373e959b8c6346fd7ec783855979d6.zip Qt-fe13d7b9ac373e959b8c6346fd7ec783855979d6.tar.gz Qt-fe13d7b9ac373e959b8c6346fd7ec783855979d6.tar.bz2 |
Use focus property, not active focus for control focus
ActiveFocus is misleading in QML, between KeyProxy and FocusRealm,
an item with focus, but not activeFocus could still get keys.
focus means 'I want key events'. Hence if focus is true,
blink the cursor.
Diffstat (limited to 'src/declarative/fx/qfxtextedit.cpp')
-rw-r--r-- | src/declarative/fx/qfxtextedit.cpp | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index a1b5484..bf7a16d 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -582,25 +582,17 @@ void QFxTextEdit::keyReleaseEvent(QKeyEvent *event) } /*! -\overload -Handles the given focus \a event. -*/ -void QFxTextEdit::focusInEvent(QFocusEvent *event) -{ - Q_D(QFxTextEdit); - QFxPaintedItem::focusInEvent(event); - d->control->processEvent(event, QPointF(0, 0)); -} - -/*! -\overload -Handles the given focus \a event. + \overload + Handles changing of the focus property. Focus is applied to the control + even if the edit does not have active focus. This is because things + like KeyProxy can give the behavior of focus even when activeFocus isn't + true. */ -void QFxTextEdit::focusOutEvent(QFocusEvent *event) +void QFxTextEdit::focusChanged(bool hasFocus) { Q_D(QFxTextEdit); - QFxPaintedItem::focusOutEvent(event); - d->control->processEvent(event, QPointF(0, 0)); + QFocusEvent focusEvent(hasFocus ? QEvent::FocusIn : QEvent::FocusOut); + d->control->processEvent(&focusEvent, QPointF(0, 0)); } static QMouseEvent *sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent *e) |