summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 848de2c..fe2a84e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3257,6 +3257,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
}
// Update the child focus chain.
+ if (scene && scene->focusItem())
+ scene->focusItem()->d_ptr->clearSubFocus();
f->d_ptr->setSubFocus();
// Update the scene's focus item.
@@ -7637,9 +7639,9 @@ int QGraphicsItemPrivate::children_count(QDeclarativeListProperty<QGraphicsObjec
QGraphicsObject *QGraphicsItemPrivate::children_at(QDeclarativeListProperty<QGraphicsObject> *list, int index)
{
QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(static_cast<QGraphicsObject *>(list->object));
- if (index >= 0 && index < d->children.count())
+ if (index >= 0 && index < d->children.count())
return d->children.at(index)->toGraphicsObject();
- else
+ else
return 0;
}
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 28070da..f7850ca 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -761,7 +761,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
QGraphicsWidget *firstOld = 0;
bool wasPreviousNew = true;
-
+
while (w != q) {
bool isCurrentNew = q->isAncestorOf(w);
if (isCurrentNew) {
@@ -796,7 +796,7 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
newScene = newParent->scene();
if (oldScene && newScene != oldScene)
- oldScene->d_func()->tabFocusFirst = firstOld;
+ oldScene->d_func()->tabFocusFirst = (firstOld && firstOld->scene() == oldScene) ? firstOld : 0;
QGraphicsItem *topLevelItem = newParent ? newParent->topLevelItem() : 0;
QGraphicsWidget *topLevel = 0;