From 3c42ca87fac3326bb86a8bb816de07223b7b2e9d Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 2 Mar 2012 10:36:10 +1000 Subject: [PATCH] Treat parentless items as focus scopes The root item of a tree is implicitly a focus scope simply because it is the root of the tree. QQuickRootItem could gain the focus scope flag in order to solve this for most cases, but there would still be a possiblity of a crash for disconnected trees. Change-Id: I6e04f11df4268fb3b96660d50707d70935a5dc5e Reviewed-by: Martin Jones --- src/quick/items/qquickitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 04f4c1f..7ca683f 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2121,7 +2121,7 @@ QQuickItem *QQuickItemPrivate::InitializationState::getFocusScope(QQuickItem *it { if (!focusScope) { QQuickItem *fs = item->parentItem(); - while (!fs->isFocusScope()) + while (fs->parentItem() && !fs->isFocusScope()) fs = fs->parentItem(); focusScope = fs; } -- 2.7.4