QmlDesigner: Fix a couple of undefined warnings

Change-Id: I6bf62904a3fc4b45252f3859d6996c28b459d949
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Henning Gruendl
2021-08-04 20:14:03 +02:00
committed by Henning Gründl
parent e9b2613f5e
commit 65055989f9
5 changed files with 51 additions and 8 deletions

View File

@@ -58,9 +58,19 @@ Row {
evaluate() evaluate()
} }
property bool isInModel: backendValue.isInModel property bool isInModel: {
if (backendValue !== undefined && backendValue.isInModel !== undefined)
return backendValue.isInModel
return false
}
onIsInModelChanged: evaluate() onIsInModelChanged: evaluate()
property bool isInSubState: backendValue.isInSubState property bool isInSubState: {
if (backendValue !== undefined && backendValue.isInSubState !== undefined)
return backendValue.isInSubState
return false
}
onIsInSubStateChanged: evaluate() onIsInSubStateChanged: evaluate()
function evaluate() { function evaluate() {

View File

@@ -55,9 +55,19 @@ Row {
evaluate() evaluate()
} }
property bool isInModel: backendValue.isInModel property bool isInModel: {
if (backendValue !== undefined && backendValue.isInModel !== undefined)
return backendValue.isInModel
return false
}
onIsInModelChanged: evaluate() onIsInModelChanged: evaluate()
property bool isInSubState: backendValue.isInSubState property bool isInSubState: {
if (backendValue !== undefined && backendValue.isInSubState !== undefined)
return backendValue.isInSubState
return false
}
onIsInSubStateChanged: evaluate() onIsInSubStateChanged: evaluate()
function evaluate() { function evaluate() {

View File

@@ -39,6 +39,9 @@ SecondColumnLayout {
property bool supportGradient: false property bool supportGradient: false
property variant backendValue property variant backendValue
property variant value: { property variant value: {
if (colorEditor.backendValue === undefined || colorEditor.backendValue.value === undefined)
return "white" // default color for Rectangle
if (colorEditor.isVector3D) if (colorEditor.isVector3D)
return Qt.rgba(colorEditor.backendValue.value.x, return Qt.rgba(colorEditor.backendValue.value.x,
colorEditor.backendValue.value.y, colorEditor.backendValue.value.y,

View File

@@ -33,8 +33,18 @@ QtObject {
property color textColor: StudioTheme.Values.themeTextColor property color textColor: StudioTheme.Values.themeTextColor
property variant valueFromBackend: backendValue === undefined ? 0 : backendValue.value property variant valueFromBackend: backendValue === undefined ? 0 : backendValue.value
property bool baseStateFlag: isBaseState property bool baseStateFlag: isBaseState
property bool isInModel: backendValue === undefined ? false : backendValue.isInModel property bool isInModel: {
property bool isInSubState: backendValue === undefined ? false : backendValue.isInSubState if (backendValue !== undefined && backendValue.isInModel !== undefined)
return backendValue.isInModel
return false
}
property bool isInSubState: {
if (backendValue !== undefined && backendValue.isInSubState !== undefined)
return backendValue.isInSubState
return false
}
property bool highlight: textColor === __changedTextColor property bool highlight: textColor === __changedTextColor
property bool errorState: false property bool errorState: false

View File

@@ -33,8 +33,18 @@ Item {
id: extendedFunctionButton id: extendedFunctionButton
property variant backendValue property variant backendValue
property bool isBoundBackend: backendValue === undefined ? false : backendValue.isBound property bool isBoundBackend: {
property string backendExpression: backendValue === undefined ? "" : backendValue.expression if (backendValue !== undefined && backendValue.isBound !== undefined)
return backendValue.isBound
return false
}
property string backendExpression: {
if (backendValue !== undefined && backendValue.expression !== undefined)
return backendValue.expression
return ""
}
property string glyph: StudioTheme.Constants.actionIcon property string glyph: StudioTheme.Constants.actionIcon
property string color: StudioTheme.Values.themeTextColor property string color: StudioTheme.Values.themeTextColor