@@ -724,77 +724,93 @@ RowLayout {
724724
725725 Component {
726726 id: listAttributeComponent
727- ColumnLayout {
728- id: listAttributeLayout
729- width: parent .width
730- property bool expanded: false
731- RowLayout {
732- spacing: 4
733- ToolButton {
734- text: listAttributeLayout .expanded ? MaterialIcons .keyboard_arrow_down : MaterialIcons .keyboard_arrow_right
735- font .family : MaterialIcons .fontFamily
736- onClicked: listAttributeLayout .expanded = ! listAttributeLayout .expanded
737- }
738- Label {
739- Layout .alignment : Qt .AlignVCenter
740- text: attribute .value .count + " elements"
727+ Item {
728+ implicitHeight: listAttributeLayout .implicitHeight
729+ implicitWidth: listAttributeLayout .implicitWidth
730+
731+ ColumnLayout {
732+ id: listAttributeLayout
733+ width: parent .width
734+ property bool expanded: false
735+ RowLayout {
736+ spacing: 4
737+ ToolButton {
738+ text: listAttributeLayout .expanded ? MaterialIcons .keyboard_arrow_down : MaterialIcons .keyboard_arrow_right
739+ font .family : MaterialIcons .fontFamily
740+ onClicked: listAttributeLayout .expanded = ! listAttributeLayout .expanded
741+ }
742+ Label {
743+ Layout .alignment : Qt .AlignVCenter
744+ text: attribute .value .count + " elements"
745+ }
746+ ToolButton {
747+ text: MaterialIcons .add_circle_outline
748+ font .family : MaterialIcons .fontFamily
749+ font .pointSize : 11
750+ padding: 2
751+ enabled: root .editable
752+ onClicked: _currentScene .appendAttribute (attribute, undefined )
753+ }
741754 }
742- ToolButton {
743- text: MaterialIcons .add_circle_outline
744- font .family : MaterialIcons .fontFamily
745- font .pointSize : 11
746- padding: 2
747- enabled: root .editable
748- onClicked: _currentScene .appendAttribute (attribute, undefined )
755+ ListView {
756+ id: lv
757+ model: listAttributeLayout .expanded ? attribute .value : undefined
758+ visible: model !== undefined && count > 0
759+ implicitHeight: Math .min (contentHeight, 300 )
760+ Layout .fillWidth : true
761+ Layout .margins : 4
762+ clip: true
763+ spacing: 4
764+
765+ ScrollBar .vertical : MScrollBar { id: sb }
766+
767+ delegate: Loader {
768+ active: ! objectsHideable
769+ || ((object .isDefault && GraphEditorSettings .showDefaultAttributes || ! object .isDefault && GraphEditorSettings .showModifiedAttributes )
770+ && (object .hasAnyInputLinks && GraphEditorSettings .showLinkAttributes || ! object .hasAnyInputLinks && GraphEditorSettings .showNotLinkAttributes ))
771+ visible: active
772+ sourceComponent: RowLayout {
773+ id: item
774+ property var childAttrib: object
775+ layoutDirection: Qt .RightToLeft
776+ width: lv .width - sb .width
777+ Component .onCompleted : {
778+ var cpt = Qt .createComponent (" AttributeItemDelegate.qml" )
779+ var obj = cpt .createObject (item,
780+ {
781+ ' attribute' : Qt .binding (function () { return item .childAttrib }),
782+ ' readOnly' : Qt .binding (function () { return ! root .editable })
783+ })
784+ obj .Layout .fillWidth = true
785+ obj .label .text = index
786+ obj .label .horizontalAlignment = Text .AlignHCenter
787+ obj .label .verticalAlignment = Text .AlignVCenter
788+ obj .doubleClicked .connect (function (attr ) { root .doubleClicked (attr) })
789+ obj .inAttributeClicked .connect (function (srcItem , mouse , inAttributes ) { root .inAttributeClicked (srcItem, mouse, inAttributes) })
790+ obj .outAttributeClicked .connect (function (srcItem , mouse , outAttributes ) { root .outAttributeClicked (srcItem, mouse, outAttributes) })
791+ }
792+ ToolButton {
793+ enabled: root .editable
794+ text: MaterialIcons .remove_circle_outline
795+ font .family : MaterialIcons .fontFamily
796+ font .pointSize : 11
797+ padding: 2
798+ ToolTip .text : " Remove Element"
799+ ToolTip .visible : hovered
800+ onClicked: _currentScene .removeAttribute (item .childAttrib )
801+ }
802+ }
803+ }
749804 }
750805 }
751- ListView {
752- id: lv
753- model: listAttributeLayout .expanded ? attribute .value : undefined
754- visible: model !== undefined && count > 0
755- implicitHeight: Math .min (contentHeight, 300 )
756- Layout .fillWidth : true
757- Layout .margins : 4
758- clip: true
759- spacing: 4
760-
761- ScrollBar .vertical : MScrollBar { id: sb }
762-
763- delegate: Loader {
764- active: ! objectsHideable
765- || ((object .isDefault && GraphEditorSettings .showDefaultAttributes || ! object .isDefault && GraphEditorSettings .showModifiedAttributes )
766- && (object .hasAnyInputLinks && GraphEditorSettings .showLinkAttributes || ! object .hasAnyInputLinks && GraphEditorSettings .showNotLinkAttributes ))
767- visible: active
768- sourceComponent: RowLayout {
769- id: item
770- property var childAttrib: object
771- layoutDirection: Qt .RightToLeft
772- width: lv .width - sb .width
773- Component .onCompleted : {
774- var cpt = Qt .createComponent (" AttributeItemDelegate.qml" )
775- var obj = cpt .createObject (item,
776- {
777- ' attribute' : Qt .binding (function () { return item .childAttrib }),
778- ' readOnly' : Qt .binding (function () { return ! root .editable })
779- })
780- obj .Layout .fillWidth = true
781- obj .label .text = index
782- obj .label .horizontalAlignment = Text .AlignHCenter
783- obj .label .verticalAlignment = Text .AlignVCenter
784- obj .doubleClicked .connect (function (attr ) { root .doubleClicked (attr) })
785- obj .inAttributeClicked .connect (function (srcItem , mouse , inAttributes ) { root .inAttributeClicked (srcItem, mouse, inAttributes) })
786- obj .outAttributeClicked .connect (function (srcItem , mouse , outAttributes ) { root .outAttributeClicked (srcItem, mouse, outAttributes) })
787- }
788- ToolButton {
789- enabled: root .editable
790- text: MaterialIcons .remove_circle_outline
791- font .family : MaterialIcons .fontFamily
792- font .pointSize : 11
793- padding: 2
794- ToolTip .text : " Remove Element"
795- ToolTip .visible : hovered
796- onClicked: _currentScene .removeAttribute (item .childAttrib )
797- }
806+
807+ DropArea {
808+ anchors .fill : parent
809+ enabled: root .editable && attribute .baseType === " File"
810+ onDropped : function (drop ) {
811+ if (drop .hasUrls ) {
812+ for (var i = 0 ; i < drop .urls .length ; ++ i)
813+ _currentScene .appendAttribute (attribute, Filepath .urlToString (drop .urls [i]))
798814 }
799815 }
800816 }
0 commit comments