EffectComposer: Fix qml warnings

Change-Id: I40abc68800b95888edae0450625f20d51fd8ed74
Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2024-02-23 17:48:29 +02:00
parent 417fbc7861
commit 3f40da0978
2 changed files with 18 additions and 10 deletions

View File

@@ -185,7 +185,7 @@ ColumnLayout {
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.clearList_medium
tooltip: qsTr("Remove all effect nodes.")
enabled: !root.backendModel.isEmpty
enabled: root.backendModel ? !root.backendModel.isEmpty : false
onClicked: {
if (root.backendModel.hasUnsavedChanges)
@@ -296,14 +296,16 @@ ColumnLayout {
} // ScrollView
Text {
text: root.backendModel.isEnabled ? qsTr("Add an effect node to start")
: qsTr("Effect Composer is disabled on MCU projects")
text: root.backendModel ? root.backendModel.isEnabled
? qsTr("Add an effect node to start")
: qsTr("Effect Composer is disabled on MCU projects")
: ""
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
anchors.centerIn: parent
visible: root.backendModel.isEmpty
visible: root.backendModel ? root.backendModel.isEmpty : false
}
} // Item
} // Column

View File

@@ -28,7 +28,7 @@ Rectangle {
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.add_medium
tooltip: qsTr("Add new composition")
enabled: root.backendModel.isEnabled
enabled: root.backendModel ? root.backendModel.isEnabled : false
onClicked: root.addClicked()
}
@@ -36,8 +36,10 @@ Rectangle {
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.save_medium
tooltip: qsTr("Save current composition")
enabled: root.backendModel.isEnabled && (root.backendModel.hasUnsavedChanges
|| root.backendModel.currentComposition === "")
enabled: root.backendModel ? root.backendModel.isEnabled
&& (root.backendModel.hasUnsavedChanges
|| root.backendModel.currentComposition === "")
: false
onClicked: root.saveClicked()
}
@@ -46,7 +48,8 @@ Rectangle {
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.saveAs_medium
tooltip: qsTr("Save current composition with a new name")
enabled: root.backendModel.isEnabled && !root.backendModel.isEmpty
enabled: root.backendModel ? root.backendModel.isEnabled && !root.backendModel.isEmpty
: false
onClicked: root.saveAsClicked()
}
@@ -55,7 +58,9 @@ Rectangle {
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.assignTo_medium
tooltip: qsTr("Assign current composition to selected item")
enabled: root.backendModel.isEnabled && root.backendModel.currentComposition !== ""
enabled: root.backendModel ? root.backendModel.isEnabled
&& root.backendModel.currentComposition !== ""
: false
onClicked: root.assignToSelectedClicked()
}
@@ -63,7 +68,8 @@ Rectangle {
Text {
readonly property string compName: root.backendModel.currentComposition
readonly property string compName: root.backendModel ? root.backendModel.currentComposition
: ""
text: compName !== "" ? compName : qsTr("Untitled")
anchors.centerIn: parent