diff options
author | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2010-12-07 13:27:14 (GMT) |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2010-12-07 20:51:16 (GMT) |
commit | 783a278f243c6411f5f32d11f2165b9eed9b6f8c (patch) | |
tree | 7c250ad639d7c669cb5622e2187ac91999479917 /src/gui/graphicsview/qgraphicsitem_p.h | |
parent | 6af078b2a13f4855a35d48376e58154ee2d57ec1 (diff) | |
download | Qt-783a278f243c6411f5f32d11f2165b9eed9b6f8c.zip Qt-783a278f243c6411f5f32d11f2165b9eed9b6f8c.tar.gz Qt-783a278f243c6411f5f32d11f2165b9eed9b6f8c.tar.bz2 |
Don't emit activeFocusChanged() unless the active focus actually changed
We would previously call subFocusItemChanged(0) on the item as part of
clearing the subfocus, even if the item in question would recieve a new
subfocus item as part of setting the new subfocus.
This resulted in the declarative item emitting activeFocusChanged(false)
and then activeFocusChanged(true), which was affecting any animation or
state bound to the activeFocus property of the item.
We now stop clearing the subfocus when encountering an item that we know
will get subfocus during the set-subfocus pass. We then set subfocus all
the way to the root item, since the subfocus item itself might change.
The effect of this is that the declarative item will only get one call
to subFocusItemChanged(), passing the new subfocus item, instead of two.
This means the declarative item can keep track of wherther ot not it had
a subfocus item previously, and only emit activeFocusChanged() when the
active focus goes from true to false or false to true.
Task-number: QTBUG-15615
Reviewed-by: Yoann Lopes <yoann.lopes@nokia.com>
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem_p.h')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 1b7aa97..b938759 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -479,8 +479,8 @@ public: void setFocusHelper(Qt::FocusReason focusReason, bool climb, bool focusFromHide); void clearFocusHelper(bool giveFocusToParent); - void setSubFocus(QGraphicsItem *rootItem = 0); - void clearSubFocus(QGraphicsItem *rootItem = 0); + void setSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0); + void clearSubFocus(QGraphicsItem *rootItem = 0, QGraphicsItem *stopItem = 0); void resetFocusProxy(); virtual void subFocusItemChange(); virtual void focusScopeItemChange(bool isSubFocusItem); |