aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-11-07 11:33:14 +0100
committerRichard Moe Gustavsen <richard.gustavsen@digia.com>2014-11-07 14:00:42 +0100
commitcb023cbc2ab494eead21b721040a0a90db0f755c (patch)
treee84d7a72bedd42c2aa7c35977fd566585da0a265
parent82c36e4ff05459a5affbb6f8fab75723baee20db (diff)
QQuickWindow: let 'clearFocusObject' clear all the way to the root
The previous code was wrong, as it cleared focus from the active focus item directly. By doing so we would only clear focus inside the focus scope that surrounded the item, but leave the scope itself with active focus (which would then be the focus object). The intended result is rather to end up with the root as focus object. Change-Id: I455a8939f8bc6c48765119b995aa781aee6d1e70 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
-rw-r--r--src/quick/items/qquickwindow.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 619e539204..262e227b16 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -893,8 +893,10 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item,
void QQuickWindowPrivate::clearFocusObject()
{
- if (activeFocusItem)
- activeFocusItem->setFocus(false, Qt::OtherFocusReason);
+ if (activeFocusItem == contentItem)
+ return;
+
+ clearFocusInScope(contentItem, QQuickItemPrivate::get(contentItem)->subFocusItem, Qt::OtherFocusReason);
}
void QQuickWindowPrivate::notifyFocusChangesRecur(QQuickItem **items, int remaining)