From 71191f1294abdfcb40720707e4722173b62fdfac Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 13 Apr 2017 19:57:22 +0200 Subject: QML UI: only assign actions in a declarative way Assigning actions in an imperative way on component complete, seems to cause a crash on some devices, assign declaratively the whole list instead, hiding the gps related actions on iOS as they are not supported on that platform. Signed-off-by: Marco Martin Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/main.qml | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) (limited to 'mobile-widgets/qml/main.qml') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 59c584df2..29ceed9f1 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -106,7 +106,7 @@ Kirigami.ApplicationWindow { bannerImageSource: "dive.jpg" - property list topActions: [ + actions: [ Kirigami.Action { text: qsTr("Dive list") onTriggered: { @@ -180,13 +180,11 @@ Kirigami.ApplicationWindow { } } } - } - ] // end topActions - - property list gpsActions: [ + }, Kirigami.Action { text: qsTr("GPS") enabled: manager.credentialStatus === QMLManager.VALID || manager.credentialStatus === QMLManager.VALID_EMAIL + visible: (Qt.platform.os !== "ios") Kirigami.Action { text: qsTr("GPS-tag dives") onTriggered: { @@ -230,10 +228,7 @@ Kirigami.ApplicationWindow { detailsWindow.endEditMode() } } - } - ] // end gpsActions - - property list bottomActions: [ + }, Kirigami.Action { text: qsTr("Developer") Kirigami.Action { @@ -263,21 +258,7 @@ Kirigami.ApplicationWindow { detailsWindow.endEditMode() } } - ] // end bottonActions - - Component.onCompleted: { - var createActions = new Array(0) - for (var i = 0; i < topActions.length; i++) - createActions.push(topActions[i]) - if (Qt.platform.os !== "ios") { - for (var i = 0; i < gpsActions.length; i++) - createActions.push(gpsActions[i]) - } - for (var i = 0; i < bottomActions.length; i++) - createActions.push(bottomActions[i]) - actions = createActions - print(actions) - } + ] // end actions MouseArea { height: childrenRect.height -- cgit v1.2.3-70-g09d2