Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/focusOnTab into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1574
Merged at revision: 1582
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/focusOnTab
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 126 lines (+28/-20)
4 files modified
src/Ubuntu/Components/1.3/TextArea.qml (+2/-8)
src/Ubuntu/Components/1.3/TextField.qml (+1/-8)
src/Ubuntu/Components/plugin/ucstyleditembase.cpp (+1/-0)
tests/unit_x11/tst_components/tst_focus.qml (+24/-4)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/focusOnTab
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+265409@code.launchpad.net

Commit message

Enable (Shift)Tab via activeFocusOnTab

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

A small comment inline.

review: Needs Information
1574. By Cris Dywan

Use setter for setActiveFocusOnTab

Revision history for this message
Zsombor Egri (zsombi) wrote :

Good to go now! Thanks!!!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/1.3/TextArea.qml'
2--- src/Ubuntu/Components/1.3/TextArea.qml 2015-05-22 14:06:03 +0000
3+++ src/Ubuntu/Components/1.3/TextArea.qml 2015-07-29 11:41:48 +0000
4@@ -178,13 +178,6 @@
5
6 // forwarded properties
7 /*!
8- Whether the TextArea should gain active focus on a mouse press. By default this
9- is set to true.
10- \qmlproperty bool activeFocusOnPress
11- */
12- property alias activeFocusOnPress: editor.activeFocusOnPress
13-
14- /*!
15 This property specifies a base URL which is used to resolve relative URLs within
16 the text. The default value is the url of the QML file instantiating the TextArea
17 item.
18@@ -757,6 +750,7 @@
19 //internals
20
21 opacity: enabled ? 1.0 : 0.3
22+ activeFocusOnPress: true
23
24 /*!\internal */
25 onVisibleChanged: {
26@@ -863,7 +857,7 @@
27 wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
28 mouseSelectionMode: TextEdit.SelectWords
29 selectByMouse: true
30- activeFocusOnPress: true
31+ activeFocusOnPress: control.activeFocusOnPress
32 onActiveFocusChanged: if (!activeFocus && inputHandler.popover) PopupUtils.close(inputHandler.popover)
33 cursorDelegate: TextCursor {
34 handler: inputHandler
35
36=== modified file 'src/Ubuntu/Components/1.3/TextField.qml'
37--- src/Ubuntu/Components/1.3/TextField.qml 2015-05-22 14:06:03 +0000
38+++ src/Ubuntu/Components/1.3/TextField.qml 2015-07-29 11:41:48 +0000
39@@ -172,13 +172,6 @@
40 property alias acceptableInput: editor.acceptableInput
41
42 /*!
43- Whether the TextField should gain active focus on a mouse press. By default
44- this is set to true.
45- \qmlproperty bool activeFocusOnPress
46- */
47- property alias activeFocusOnPress: editor.activeFocusOnPress
48-
49- /*!
50 Whether the TextField should scroll when the text is longer than the width.
51 By default this is set to true.
52
53@@ -999,7 +992,7 @@
54
55 // overrides
56 selectByMouse: true
57- activeFocusOnPress: true
58+ activeFocusOnPress: control.activeFocusOnPress
59 onActiveFocusChanged: if (!activeFocus && inputHandler.popover) PopupUtils.close(inputHandler.popover)
60
61 // input selection and navigation handling
62
63=== modified file 'src/Ubuntu/Components/plugin/ucstyleditembase.cpp'
64--- src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-06-02 12:37:41 +0000
65+++ src/Ubuntu/Components/plugin/ucstyleditembase.cpp 2015-07-29 11:41:48 +0000
66@@ -203,6 +203,7 @@
67 return;
68 d->activeFocusOnPress = value;
69 d->setFocusable(d->activeFocusOnPress);
70+ setActiveFocusOnTab(value);
71 Q_EMIT activeFocusOnPressChanged();
72 }
73
74
75=== modified file 'tests/unit_x11/tst_components/tst_focus.qml'
76--- tests/unit_x11/tst_components/tst_focus.qml 2015-03-03 13:20:06 +0000
77+++ tests/unit_x11/tst_components/tst_focus.qml 2015-07-29 11:41:48 +0000
78@@ -17,10 +17,10 @@
79 import QtQuick 2.2
80 import QtTest 1.0
81 import Ubuntu.Test 1.0
82-import Ubuntu.Components 1.1
83-import Ubuntu.Components.Pickers 1.0
84-import Ubuntu.Components.ListItems 1.0 as ListItem
85-import Ubuntu.Components.Popups 1.0
86+import Ubuntu.Components 1.3
87+import Ubuntu.Components.Pickers 1.3
88+import Ubuntu.Components.ListItems 1.3 as ListItem
89+import Ubuntu.Components.Popups 1.3
90
91 Item {
92 id: main
93@@ -45,6 +45,9 @@
94 text: "Whatever"
95 }
96 }
97+ Button {
98+ id: dummy
99+ }
100 TextField {
101 id: textField
102 text: "This is a text field with some text handling focus"
103@@ -178,6 +181,23 @@
104 waitForRendering(data.focusOn, 200);
105 }
106
107+ function test_tab_focus_data() {
108+ return [
109+ {tag: "TextField", from: dummy, to: textField, key: Qt.Key_Tab},
110+ {tag: "TextField(back)", from: textField, to: dummy, key: Qt.Key_Backtab},
111+ {tag: "TextArea", from: textField, to: textArea, key: Qt.Key_Tab},
112+ {tag: "TextArea(back)", from: textArea, to: textField, key: Qt.Key_Backtab},
113+ {tag: "Button(back)", from: button, to: textArea, key: Qt.Key_Backtab},
114+ ];
115+ }
116+ function test_tab_focus(data) {
117+ data.from.forceActiveFocus();
118+ verify(data.from.focus, "Source component is not focused");
119+ keyClick(data.key);
120+ waitForRendering(data.to, 200);
121+ verify(data.to.focus, "Target component is not focused");
122+ }
123+
124 function test_hide_osk_when_pickerpanel_opens() {
125 if (!main.hasOSK) {
126 skip("This functionality can be tested with OSK only.");

Subscribers

People subscribed via source and target branches