on xenial help sign in
fix focus with selec/enter/escape in spread
e7ba9daMichael Zanetti
qml/Stage/Spread/Spread.qml+3−2
@@ -21,6 +21,7 @@ Item {
21 property real leftStackScale: .82
21 property real leftStackScale: .82
22 property real rightStackScale: 1
22 property real rightStackScale: 1
23
23
24+ signal leaveSpread()
24
25
25 // Calculated stuff
26 // Calculated stuff
26 readonly property int totalItemCount: model.count
27 readonly property int totalItemCount: model.count
@@ -123,12 +124,12 @@ Item {
123 event.accepted = true;
124 event.accepted = true;
124 break;
125 break;
125 case Qt.Key_Escape:
126 case Qt.Key_Escape:
126− spreadItem.highlightedIndex = -1
127+ highlightedIndex = -1
127 // Falling through intentionally
128 // Falling through intentionally
128 case Qt.Key_Enter:
129 case Qt.Key_Enter:
129 case Qt.Key_Return:
130 case Qt.Key_Return:
130 case Qt.Key_Space:
131 case Qt.Key_Space:
131− root.state = ""
132+ root.leaveSpread();
132 event.accepted = true;
133 event.accepted = true;
133 }
134 }
134 }
135 }
qml/Stage/Stage.qml+10−3
@@ -50,6 +50,8 @@ AbstractStage {
50
50
51 orientationChangesEnabled: true
51 orientationChangesEnabled: true
52
52
53+ onAltTabPressedChanged: priv.goneToSpread = altTabPressed
54+
53 GlobalShortcut {
55 GlobalShortcut {
54 id: closeWindowShortcut
56 id: closeWindowShortcut
55 shortcut: Qt.AltModifier|Qt.Key_F4
57 shortcut: Qt.AltModifier|Qt.Key_F4
@@ -290,7 +292,7 @@ AbstractStage {
290
292
291 states: [
293 states: [
292 State {
294 State {
293− name: "spread"; when: root.altTabPressed || priv.goneToSpread
295+ name: "spread"; when: priv.goneToSpread
294 PropertyChanges { target: floatingFlickable; enabled: true }
296 PropertyChanges { target: floatingFlickable; enabled: true }
295 PropertyChanges { target: spreadItem; focus: true }
297 PropertyChanges { target: spreadItem; focus: true }
296 },
298 },
@@ -330,8 +332,9 @@ AbstractStage {
330 Transition {
332 Transition {
331 from: "spread"
333 from: "spread"
332 SequentialAnimation {
334 SequentialAnimation {
333− ScriptAction { script: {
335+ ScriptAction {
336+ script: {
334− var item = appRepeater.itemAt(spreadItem.highlightedIndex);
337+ var item = appRepeater.itemAt(Math.max(0, spreadItem.highlightedIndex));
335 item.claimFocus();
338 item.claimFocus();
336 item.playFocusAnimation();
339 item.playFocusAnimation();
337 }
340 }
@@ -368,6 +371,10 @@ AbstractStage {
368 leftMargin: root.leftMargin
371 leftMargin: root.leftMargin
369 model: root.topLevelSurfaceList
372 model: root.topLevelSurfaceList
370 z: 10
373 z: 10
374+
375+ onLeaveSpread: {
376+ priv.goneToSpread = false;
377+ }
371 }
378 }
372
379
373 Connections {
380 Connections {