on xenial help sign in
Merge focus refactor from dandrader
commit04507b7ecab1214020f3948853bd3bb1a809e3c4 authorMichael Terry <michael.terry@canonical.com> dateFri 8 Jul 2016, 09:24 (10 years ago) parentdb11c19
1 file changed+11−14
qml/Greeter/GreeterPrompt.qml+11−14
qml/Greeter/GreeterPrompt.qml+11−14
@@ -60,17 +60,21 @@ FocusScope {
6060 color: "transparent"
6161 }
6262
63+ Component.onCompleted: updateFocus()
64+ onIsPromptChanged: updateFocus()
65+ function updateFocus() {
66+ if (root.isPrompt) {
67+ passwordInput.focus = true;
68+ } else {
69+ promptButton.focus = true;
70+ }
71+ }
72+
6373 AbstractButton {
74+ id: promptButton
6475 objectName: "promptButton"
6576 anchors.fill: parent
6677 visible: !root.isPrompt
67− focus: visible
68−
69− onVisibleChanged: {
70− // Qt owns focus, we can't keep our binding active. So make sure
71− // focus stays in sync manually.
72− focus = visible;
73− }
7478
7579 onClicked: {
7680 if (d.enabled) {
@@ -92,13 +96,6 @@ FocusScope {
9296 anchors.fill: parent
9397 visible: root.isPrompt
9498 opacity: fakeLabel.visible ? 0 : 1
95− focus: visible
96−
97− onVisibleChanged: {
98− // Qt owns focus, we can't keep our binding active. So make sure
99− // focus stays in sync manually.
100− focus = visible;
101− }
10299
103100 validator: RegExpValidator {
104101 regExp: root.isAlphanumeric ? /^.*$/ : /^\d{4}$/