summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index f223cbe..e54efe0 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2356,6 +2356,10 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+ // Auto-activate the first inactive window if the scene is active.
+ if (d->activationRefCount > 0 && !d->activeWindow && item->isWindow())
+ setActiveWindow(static_cast<QGraphicsWidget *>(item));
+
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
if (!d->focusItem && item->focusItem())