on xenial help sign in
use surface anchors rather than internal item
commitd2cb49dca536e1ea102085ee8f51a84e1dd4e02e authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 23 Jul 2014, 13:20 (12 years ago) parent50d40be
2 files changed+11−13
qml/Stages/SpreadDelegate.qml+2−3 qml/Stages/SurfaceContainer.qml+9−10
qml/Stages/SpreadDelegate.qml+2−3
@@ -30,7 +30,7 @@ Item {
3030 property real maximizedAppTopMargin
3131 property alias swipeToCloseEnabled: dragArea.enabled
3232
33− readonly property bool isFullscreen: surface !== null && surfaceContainer.surfaceArea.anchors.topMargin == 0
33+ readonly property bool isFullscreen: surface !== null && surfaceContainer.surface.anchors.topMargin == 0
3434
3535 signal clicked()
3636 signal closed()
@@ -56,10 +56,9 @@ Item {
5656 }
5757
5858 Binding {
59− target: surfaceContainer.surfaceArea
59+ target: surfaceContainer.surface
6060 property: "anchors.topMargin"
6161 value: {
62− if (!surfaceContainer.surface) return 0;
6362 return surfaceContainer.surface.state === MirSurfaceItem.Fullscreen ? 0 : maximizedAppTopMargin;
6463 }
6564 }
qml/Stages/SurfaceContainer.qml+9−10
@@ -20,7 +20,6 @@ import "Animations"
2020Item {
2121 id: container
2222 property Item surface: null
23− readonly property alias surfaceArea: _surfaceArea
2423 property bool removing: false
2524
2625 onSurfaceChanged: {
@@ -31,12 +30,6 @@ Item {
3130 }
3231 }
3332
34− Rectangle {
35− id: _surfaceArea
36− anchors.fill: parent
37− color: Qt.rgba(0,0,0,0)
38− }
39−
4033 Connections {
4134 target: surface
4235 onRemoved: {
@@ -63,7 +56,13 @@ Item {
6356
6457 delegate: Loader {
6558 z: 2
66− anchors.fill: surfaceArea
59+ anchors {
60+ fill: container
61+ topMargin: container.surface.anchors.topMargin
62+ rightMargin: container.surface.anchors.rightMargin
63+ bottomMargin: container.surface.anchors.bottomMargin
64+ leftMargin: container.surface.anchors.leftMargin
65+ }
6766
6867 // Only way to do recursive qml items.
6968 source: Qt.resolvedUrl("SurfaceContainer.qml")
@@ -76,7 +75,7 @@ Item {
7675 }
7776
7877 function animateIn(component) {
79− var animation = component.createObject(container, { "surface": container.surface, "surfaceArea": container.surfaceArea });
78+ var animation = component.createObject(container, { "surface": container.surface, "surfaceArea": container });
8079 animation.start();
8180
8281 var tmp = d.animations;
@@ -117,7 +116,7 @@ Item {
117116 states: [
118117 State {
119118 name: "initial"
120− PropertyChanges { target: surface; anchors.fill: surfaceArea }
119+ PropertyChanges { target: surface; anchors.fill: container }
121120 }
122121 // TODO: more animations!
123122 ]