mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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 <notmart@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a0c6cf5c89
commit
71191f1294
1 changed files with 5 additions and 24 deletions
|
@ -106,7 +106,7 @@ Kirigami.ApplicationWindow {
|
|||
|
||||
bannerImageSource: "dive.jpg"
|
||||
|
||||
property list<QtObject> topActions: [
|
||||
actions: [
|
||||
Kirigami.Action {
|
||||
text: qsTr("Dive list")
|
||||
onTriggered: {
|
||||
|
@ -180,13 +180,11 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
] // end topActions
|
||||
|
||||
property list<QtObject> 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<QtObject> 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
|
||||
|
|
Loading…
Reference in a new issue