on xenial help sign in
Help Qml decide to destroy the tutorial when it is unloaded
commit1975165e01a545dd87c25bc05334691edb8c2956 authorMichael Terry <michael.terry@canonical.com> dateThu 26 Mar 2015, 10:40 (12 years ago) parent3a8c658
4 files changed+21−38
qml/Shell.qml+16−17 qml/Tutorial/Tutorial.qml−14 qml/Tutorial/TutorialContent.qml−7 tests/qmltests/tst_Shell.qml+5
qml/Shell.qml+16−17
@@ -283,6 +283,22 @@ Item {
283283 value: shell.background
284284 }
285285 }
286+
287+ Tutorial {
288+ id: tutorial
289+ objectName: "tutorial"
290+ anchors.fill: parent
291+ active: AccountsService.demoEdges
292+ paused: LightDM.Greeter.active
293+ launcher: launcher
294+ panel: panel
295+ edgeSize: shell.edgeSize
296+
297+ onFinished: {
298+ AccountsService.demoEdges = false;
299+ active = false; // for immediate response / if AS is having problems
300+ }
301+ }
286302 }
287303
288304 InputMethod {
@@ -580,23 +596,6 @@ Item {
580596 }
581597 }
582598
583− Tutorial {
584− id: tutorial
585− objectName: "tutorial"
586− active: AccountsService.demoEdges
587− paused: LightDM.Greeter.active
588− launcher: launcher
589− panel: panel
590− stages: stages
591− overlay: overlay
592− edgeSize: shell.edgeSize
593−
594− onFinished: {
595− AccountsService.demoEdges = false;
596− active = false; // for immediate response / if AS is having problems
597− }
598− }
599−
600599 Connections {
601600 target: SessionBroadcast
602601 onShowHome: showHome()
qml/Tutorial/Tutorial.qml−14
@@ -26,8 +26,6 @@ Item {
2626
2727 property Item launcher
2828 property Item panel
29− property Item stages
30− property Item overlay
3129
3230 readonly property bool launcherEnabled: loader.item ? loader.item.launcherEnabled : true
3331 readonly property bool spreadEnabled: loader.item ? loader.item.spreadEnabled : true
@@ -72,18 +70,6 @@ Item {
7270 value: root.panel
7371 }
7472
75− Binding {
76− target: loader.item
77− property: "stages"
78− value: root.stages
79− }
80−
81− Binding {
82− target: loader.item
83− property: "overlay"
84− value: root.overlay
85− }
86−
8773 Connections {
8874 target: loader.item
8975 onFinished: root.finished()
qml/Tutorial/TutorialContent.qml−7
@@ -22,8 +22,6 @@ Item {
2222
2323 property Item launcher
2424 property Item panel
25− property Item stages
26− property Item overlay
2725
2826 readonly property bool launcherEnabled: !running ||
2927 (!paused && tutorialLeft.shown)
@@ -66,7 +64,6 @@ Item {
6664 TutorialLeft {
6765 id: tutorialLeft
6866 objectName: "tutorialLeft"
69− parent: root.stages
7067 anchors.fill: parent
7168 launcher: root.launcher
7269 paused: !shown || root.paused
@@ -77,7 +74,6 @@ Item {
7774 TutorialLeftFinish {
7875 id: tutorialLeftFinish
7976 objectName: "tutorialLeftFinish"
80− parent: root.stages
8177 anchors.fill: parent
8278 textXOffset: root.launcher.panelWidth
8379 paused: !shown || root.paused
@@ -91,7 +87,6 @@ Item {
9187 TutorialRight {
9288 id: tutorialRight
9389 objectName: "tutorialRight"
94− parent: root.stages
9590 anchors.fill: parent
9691 edgeSize: root.edgeSize
9792 panel: root.panel
@@ -103,7 +98,6 @@ Item {
10398 TutorialBottom {
10499 id: tutorialBottom
105100 objectName: "tutorialBottom"
106− parent: root.stages
107101 anchors.fill: parent
108102 edgeSize: root.edgeSize
109103 paused: !shown || root.paused
@@ -114,7 +108,6 @@ Item {
114108 TutorialBottomFinish {
115109 id: tutorialBottomFinish
116110 objectName: "tutorialBottomFinish"
117− parent: root.stages
118111 anchors.fill: parent
119112 backgroundFadesOut: true
120113 paused: !shown || root.paused
tests/qmltests/tst_Shell.qml+5
@@ -988,6 +988,11 @@ Rectangle {
988988 tryCompare(ApplicationManager, "focusedApplicationId", "gallery-app");
989989 compare(wizard.shown, false);
990990 compare(tutorial.running, false);
991+ tryCompare(AccountsService, "demoEdges", false);
992+ tryCompare(Wizard.System, "wizardEnabled", false);
993+
994+ var tutorialLeft = findChild(tutorial, "tutorialLeft");
995+ compare(tutorialLeft, null); // should be destroyed with tutorial
991996 }
992997
993998 function test_tapOnRightEdgeReachesApplicationSurface() {