on xenial help sign in
Use Binding instead of connecting/disconnecting via JS.
commitf3a4e22fe93f2f8faefadf056dc91a02b61974a3 authorGerry Boland <gerry.boland@canonical.com> dateWed 3 Sep 2014, 13:25 (12 years ago) parentc915fa0
2 files changed+9−10
qml/Stages/PhoneStage.qml+8−9 qml/Stages/TabletStage.qml+1−1
qml/Stages/PhoneStage.qml+8−9
@@ -31,7 +31,7 @@ Rectangle {
3131 property bool interactive
3232 property bool spreadEnabled: true // If false, animations and right edge will be disabled
3333 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
34− property int orientation
34+ property int orientation: Qt.PortraitOrientation
3535
3636 color: "black"
3737
@@ -369,6 +369,13 @@ Rectangle {
369369 progress: appDelegate.progress - spreadView.positionMarker1
370370 }
371371
372+ Binding {
373+ target: appDelegate
374+ property: "orientation"
375+ when: appDelegate.interactive
376+ value: root.orientation
377+ }
378+
372379 onClicked: {
373380 if (spreadView.phase == 2) {
374381 if (ApplicationManager.focusedApplicationId == ApplicationManager.get(index).appId) {
@@ -391,14 +398,6 @@ Rectangle {
391398 spreadView.closingIndex = index;
392399 ApplicationManager.stopApplication(ApplicationManager.get(index).appId);
393400 }
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− }
402401 }
403402 }
404403 }
qml/Stages/TabletStage.qml+1−1
@@ -34,7 +34,7 @@ Rectangle {
3434 property real maximizedAppTopMargin
3535 property bool interactive
3636 property real inverseProgress: 0 // This is the progress for left edge drags, in pixels.
37− property int orientation
37+ property int orientation: Qt.PortraitOrientation
3838
3939 onInverseProgressChanged: {
4040 if (inverseProgress == 0 && priv.oldInverseProgress > 0) {