@@ -24,27 +24,23 @@ RowLayout {
2424 property int labelWidth // Shortcut to set the fixed size of the Label
2525
2626 readonly property bool editable: ! attribute .isOutput && ! attribute .isLink && ! readOnly
27+ property var errorMessages: attribute .errorMessages
2728
2829 signal doubleClicked (var mouse, var attr)
2930 signal inAttributeClicked (var srcItem, var mouse, var inAttributes)
3031 signal outAttributeClicked (var srcItem, var mouse, var outAttributes)
3132 signal showInViewer (var attr)
3233
33- spacing: 2
34-
35- function updateAttributeLabel () {
36- background .color = attribute .validValue ? Qt .darker (palette .window , 1.1 ) : Qt .darker (Colors .red , 1.5 )
37-
38- if (attribute .desc ) {
39- var tooltip = " "
40- if (! attribute .validValue && attribute .desc .errorMessage !== " " )
41- tooltip += " <i><b>Error: </b>" + Format .plainToHtml (attribute .desc .errorMessage ) + " </i><br><br>"
42- tooltip += " <b> " + attribute .desc .name + " :</b> " + attribute .type + " <br>" + Format .plainToHtml (attribute .desc .description )
43-
44- parameterTooltip .text = tooltip
34+ Connections {
35+ target: attribute
36+ function onValueChanged () {
37+ root .errorMessages = attribute .errorMessages
4538 }
39+
4640 }
4741
42+ spacing: 2
43+
4844 Pane {
4945 background: Rectangle {
5046 id: background
@@ -272,6 +268,7 @@ RowLayout {
272268 }
273269 }
274270
271+
275272 Loader {
276273 Layout .fillWidth : true
277274 id: inputField
@@ -340,8 +337,7 @@ RowLayout {
340337 id: textFieldComponent
341338
342339 RowLayout {
343- anchors .fill : parent
344- property var errorMessages: attribute .errorMessages
340+ anchors .fill : parent
345341
346342 TextField {
347343 id: textField
@@ -379,8 +375,7 @@ RowLayout {
379375 persistentSelection: false
380376
381377 onEditingFinished: {
382- setTextFieldAttribute (text)
383- errorMessages = attribute .errorMessages
378+ setTextFieldAttribute (text)
384379 }
385380
386381 onAccepted: {
@@ -469,15 +464,8 @@ RowLayout {
469464 }
470465 }
471466
472- MaterialLabel {
473- visible: ! attribute .isOutput && errorMessages .length
474- text: MaterialIcons .fmd_bad
475- ToolTip .text : errorMessages .join (" \n " )
476- color: " orange"
477- }
478467 }
479-
480-
468+
481469 }
482470
483471 Component {
@@ -862,4 +850,11 @@ RowLayout {
862850 }
863851 }
864852 }
853+
854+ MaterialLabel {
855+ visible: ! attribute .isOutput && root .errorMessages .length
856+ text: MaterialIcons .fmd_bad
857+ ToolTip .text : root .errorMessages .join (" \n " )
858+ color: " orange"
859+ }
865860}
0 commit comments