summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-10-10 11:33:14 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2014-10-27 12:07:12 +0100
commit19a1de32e68389147566ab7d51df47946511d847 (patch)
tree3f78dab69284119e1ddd56212509668d856d32f3
parent8b2d7ad3e0b8ca0475414a03afc92de1a60f24cf (diff)
downloadqtquickcontrols-19a1de32e68389147566ab7d51df47946511d847.tar.gz
Dialog: give the contentItem focus when the dialog becomes visible
The focus binding didn't work if the default content item was replaced, as in the "buttonless marginless dialog" example. Change-Id: Ice6bea21e9fe51bbdbf8cadba8de0d5ed7240285 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
-rw-r--r--src/dialogs/DefaultDialogWrapper.qml2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dialogs/DefaultDialogWrapper.qml b/src/dialogs/DefaultDialogWrapper.qml
index 97e645c4..014c38a7 100644
--- a/src/dialogs/DefaultDialogWrapper.qml
+++ b/src/dialogs/DefaultDialogWrapper.qml
@@ -48,6 +48,7 @@ import "qml"
AbstractDialog {
id: root
default property alias data: defaultContentItem.data
+ onVisibilityChanged: if (visible && contentItem) contentItem.forceActiveFocus()
Rectangle {
id: content
@@ -61,7 +62,6 @@ AbstractDialog {
implicitWidth: Math.min(root.__maximumDimension, Math.max(
defaultContentItem.implicitWidth, buttonsRowImplicitWidth, Screen.pixelDensity * 50) + outerSpacing * 2);
color: palette.window
- focus: root.visible
Keys.onPressed: {
event.accepted = true
switch (event.key) {