[GraphEditor] Do not assign undefined to edge-related properties

This fixes the following QML warnings that may appear when performing
lots of operations on edges:
`Unable to assign [undefined] to QString/bool`

These warnings do not seem to have any functional impact on the connection
processes.
This commit is contained in:
Candice Bentéjac 2024-09-03 16:29:06 +02:00
parent 321ffec85f
commit 7686c48e89
2 changed files with 11 additions and 11 deletions

View file

@ -130,8 +130,8 @@ RowLayout {
readonly property string connectorType: "input"
readonly property alias attribute: root.attribute
readonly property alias nodeItem: root.nodeItem
readonly property bool isOutput: attribute.isOutput
readonly property string baseType: attribute.baseType
readonly property bool isOutput: Boolean(attribute.isOutput)
readonly property string baseType: attribute.baseType !== undefined ? attribute.baseType : ""
readonly property alias isList: root.isList
property bool dragAccepted: false
anchors.verticalCenter: parent.verticalCenter
@ -192,7 +192,7 @@ RowLayout {
enabled: !root.readOnly
property bool hovered: (inputConnectMA.containsMouse || inputConnectMA.drag.active || inputDropArea.containsDrag || outputConnectMA.containsMouse || outputConnectMA.drag.active || outputDropArea.containsDrag)
text: attribute ? attribute.label : ""
text: (attribute && attribute.label) !== undefined ? attribute.label : ""
elide: hovered ? Text.ElideNone : Text.ElideMiddle
width: hovered ? contentWidth : parent.width
font.pointSize: 7
@ -279,9 +279,9 @@ RowLayout {
readonly property string connectorType: "output"
readonly property alias attribute: root.attribute
readonly property alias nodeItem: root.nodeItem
readonly property bool isOutput: attribute.isOutput
readonly property bool isOutput: Boolean(attribute.isOutput)
readonly property alias isList: root.isList
readonly property string baseType: attribute.baseType
readonly property string baseType: attribute.baseType !== undefined ? attribute.baseType : ""
property bool dropAccepted: false
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter

View file

@ -407,8 +407,8 @@ Item {
delegate: Loader {
id: outputLoader
active: object.isOutput && object.desc.visible
visible: object.enabled || object.hasOutputConnections
active: Boolean(object.isOutput && object.desc.visible)
visible: Boolean(object.enabled || object.hasOutputConnections)
anchors.right: parent.right
width: outputs.width
@ -443,7 +443,7 @@ Item {
delegate: Loader {
id: inputLoader
active: !object.isOutput && isFileAttributeBaseType(object)
visible: object.enabled
visible: Boolean(object.enabled)
width: inputs.width
sourceComponent: AttributePin {
@ -503,8 +503,8 @@ Item {
delegate: Loader {
id: paramLoader
active: !object.isOutput && !isFileAttributeBaseType(object)
visible: object.enabled || object.isLink || object.hasOutputConnections
property bool isFullyActive: (m.displayParams || object.isLink || object.hasOutputConnections)
visible: Boolean(object.enabled || object.isLink || object.hasOutputConnections)
property bool isFullyActive: Boolean(m.displayParams || object.isLink || object.hasOutputConnections)
width: parent.width
sourceComponent: AttributePin {
@ -517,7 +517,7 @@ Item {
Behavior on height { PropertyAnimation {easing.type: Easing.Linear} }
visible: (height == childrenRect.height)
attribute: object
readOnly: root.readOnly || object.isReadOnly
readOnly: Boolean(root.readOnly || object.isReadOnly)
Component.onCompleted: attributePinCreated(attribute, inParamsPin)
Component.onDestruction: attributePinDeleted(attribute, inParamsPin)
onPressed: root.pressed(mouse)