summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview/qgraphicsitem.cpp')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 31fd53a..4f8755e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1007,6 +1007,9 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
setEnabledHelper(parent->isEnabled(), /* explicit = */ false, /* update = */ !implicitUpdate);
}
+ // Auto-activate if visible and the parent is active.
+ if (q->isVisible() && parent->isActive())
+ q->setActive(true);
} else {
// Inherit ancestor flags from the new parent.
updateAncestorFlag(QGraphicsItem::GraphicsItemFlag(-2));
@@ -1941,6 +1944,17 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
child->d_ptr->setVisibleHelper(newVisible, false, updateChildren);
}
+ // Update activation
+ if (scene && q->isPanel()) {
+ if (newVisible) {
+ if (parent && parent->isActive())
+ q->setActive(true);
+ } else {
+ if (q->isActive())
+ scene->setActivePanel(parent);
+ }
+ }
+
// Enable subfocus
if (newVisible && isWidget) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);