on xenial help sign in
Use Binding instead of connecting/disconnecting via JS.
f3a4e22Gerry Boland
qml/Stages/PhoneStage.qml+8−9
@@ -31,7 +31,7 @@ Rectangle {
31 property bool interactive
31 property bool interactive
32 property bool spreadEnabled: true // If false, animations and right edge will be disabled
32 property bool spreadEnabled: true // If false, animations and right edge will be disabled
33 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
33 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
34− property int orientation
34+ property int orientation: Qt.PortraitOrientation
35
35
36 color: "black"
36 color: "black"
37
37
@@ -369,6 +369,13 @@ Rectangle {
369 progress: appDelegate.progress - spreadView.positionMarker1
369 progress: appDelegate.progress - spreadView.positionMarker1
370 }
370 }
371
371
372+ Binding {
373+ target: appDelegate
374+ property: "orientation"
375+ when: appDelegate.interactive
376+ value: root.orientation
377+ }
378+
372 onClicked: {
379 onClicked: {
373 if (spreadView.phase == 2) {
380 if (spreadView.phase == 2) {
374 if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
381 if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
@@ -391,14 +398,6 @@ Rectangle {
391 spreadView.closingIndex = index;
398 spreadView.closingIndex = index;
392 ApplicationManager.stopApplication(ApplicationManager.get(index).appId);
399 ApplicationManager.stopApplication(ApplicationManager.get(index).appId);
393 }
400 }
394−
395− onInteractiveChanged: {
396− if (interactive) {
397− appDelegate.orientation = Qt.binding( function() { return root.orientation; } );
398− } else {
399− appDelegate.orientation = root.orientation; // breaks the binding intentionally
400− }
401− }
402 }
401 }
403 }
402 }
404 }
403 }
qml/Stages/TabletStage.qml+1−1
@@ -34,7 +34,7 @@ Rectangle {
34 property real maximizedAppTopMargin
34 property real maximizedAppTopMargin
35 property bool interactive
35 property bool interactive
36 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
36 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
37− property int orientation
37+ property int orientation: Qt.PortraitOrientation
38
38
39 onInverseProgressChanged: {
39 onInverseProgressChanged: {
40 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {
40 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {