summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorChristoph Schleifenbaum <christoph.schleifenbaum@kdab.com>2013-11-16 17:17:15 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-18 20:38:41 +0100
commit7e768dde39f9365a4e1fc45afc492b74744a44e6 (patch)
treebecb18ac732d133bcc289d843bc1f1370be4d9b1 /src/widgets
parentcd93a2c0e14090cecbe3e83748937dcd15d98dbe (diff)
Widgets: Never revoke focus by click on focused widget.
When clicking on a widget currently focused, w/o having Qt::ClickFocus set as focus policy, the focus should stay on the widget and not get propagated to the widget's parent. Task-number: QTBUG-34042 Change-Id: I53f1153829cc7228de02a90e38125b5cf4ee5008 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qapplication.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 4e3ecf144a..9056ffe461 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3761,6 +3761,16 @@ void QApplicationPrivate::giveFocusAccordingToFocusPolicy(QWidget *widget, QEven
}
if (focusWidget->isWindow())
break;
+
+ // find out whether this widget (or its proxy) already has focus
+ QWidget *f = focusWidget;
+ if (focusWidget->d_func()->extra && focusWidget->d_func()->extra->focus_proxy)
+ f = focusWidget->d_func()->extra->focus_proxy;
+ // if it has, stop here.
+ // otherwise a click on the focused widget would remove its focus if ClickFocus isn't set
+ if (f->hasFocus())
+ break;
+
localPos += focusWidget->pos();
focusWidget = focusWidget->parentWidget();
}