diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-04-30 10:35:06 +0300 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-08 06:47:29 +0200 |
commit | 01bc34088eb8e7fb4842fa1c2117cddbac086136 (patch) | |
tree | 60153a770c9e50faa04afd3cb23073f1f5f5d776 /src/widgets/graphicsview | |
parent | bf2a0c795ed3a9c14e6cbbabc4456f3e9ebf7d6d (diff) |
Fix tabFocusFirst when that item is removed from QGraphicsScene
If tabFocusFirst is not cleared or set to another valid item,
there will be crash later if the removed item is deleted after
removal.
Task-number: QTBUG-30923
Change-Id: Iba9a6ce9334c52f8e552b0accda95ebb5fcfcdb1
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsscene.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 8a0b983c73..88cccb5118 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -637,6 +637,15 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) if (item == lastActivePanel) lastActivePanel = 0; + // Change tabFocusFirst to the next widget in focus chain if removing the current one. + if (item == tabFocusFirst) { + QGraphicsWidgetPrivate *wd = tabFocusFirst->d_func(); + if (wd->focusNext && wd->focusNext != tabFocusFirst && wd->focusNext->scene() == q) + tabFocusFirst = wd->focusNext; + else + tabFocusFirst = 0; + } + // Cancel active touches { QMap<int, QGraphicsItem *>::iterator it = itemForTouchPointId.begin(); |