diff options
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 12 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 6249822..56182d1 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1150,6 +1150,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q if (q_ptr == fsi || q_ptr->isAncestorOf(fsi)) { parentFocusScopeItem = fsi; p->d_ptr->focusScopeItem = 0; + fsi->d_ptr->focusScopeItemChange(false); } break; } @@ -1182,6 +1183,7 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent, const Q while (p) { if (p->d_ptr->flags & QGraphicsItem::ItemIsFocusScope) { p->d_ptr->focusScopeItem = newFocusScopeItem; + newFocusScopeItem->d_ptr->focusScopeItemChange(true); // Ensure the new item is no longer the subFocusItem. The // only way to set focus on a child of a focus scope is // by setting focus on the scope itself. @@ -5587,6 +5589,16 @@ void QGraphicsItemPrivate::subFocusItemChange() /*! \internal + Subclasses can reimplement this function to be notified when an item + becomes a focusScopeItem (or is no longer a focusScopeItem). +*/ +void QGraphicsItemPrivate::focusScopeItemChange(bool isSubFocusItem) +{ +} + +/*! + \internal + Subclasses can reimplement this function to be notified when its siblingIndex order is changed. */ diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 5b9a710..d60dffb 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -482,6 +482,7 @@ public: void clearSubFocus(QGraphicsItem *rootItem = 0); void resetFocusProxy(); virtual void subFocusItemChange(); + virtual void focusScopeItemChange(bool isSubFocusItem); static void children_append(QDeclarativeListProperty<QGraphicsObject> *list, QGraphicsObject *item); static int children_count(QDeclarativeListProperty<QGraphicsObject> *list); |