aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-01-22 14:25:48 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-22 10:56:19 +0200
commite60d8a28034550ae08b258494726050ea9638602 (patch)
tree0a127ea27be7afd688149ef9170d2ca6bc6487af /src
parent007683512faa65c0d575bf12b9b1a3251c03d857 (diff)
If a popup window is opened, do not change the focus
It's not working to have QQuickWindow lose focus every time a menu is opened. This doesn't happen on OSX because menus are implemented as special native ones, but on X11 a menu is another window. In QtQuick Controls it's useful for copy/cut/paste Actions to be enabled based on whether some text has focus. Change-Id: I092b46133b9a8a44639ad9d89ee2bdfe30206bd9 Task-number: QTBUG-36292 Task-number: QTBUG-36332 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickitem.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 6afdc69291..3f0dae8070 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -6391,10 +6391,12 @@ void QQuickItem::setFocus(bool focus, Qt::FocusReason reason)
while (scope && !scope->isFocusScope() && scope->parentItem())
scope = scope->parentItem();
if (d->window) {
- if (focus)
- QQuickWindowPrivate::get(d->window)->setFocusInScope(scope, this, reason);
- else
- QQuickWindowPrivate::get(d->window)->clearFocusInScope(scope, this, reason);
+ if (reason != Qt::PopupFocusReason) {
+ if (focus)
+ QQuickWindowPrivate::get(d->window)->setFocusInScope(scope, this, reason);
+ else
+ QQuickWindowPrivate::get(d->window)->clearFocusInScope(scope, this, reason);
+ }
} else {
// do the focus changes from setFocusInScope/clearFocusInScope that are
// unrelated to a window