Unsolved QML Listview und delegate
-
Hallo zusammen,
ich versuche gerade die Elemente meiner Liste (in C++ definiert und mit Q_PROPERTY exportiert) in QML mittels Listview und model delegate horizontal anzuordnen. Allerdings wird nur das Erste Element angezeigt.
Das Listview Element ist folgendermaßen definiert:
Panel { property Cache cache width: parent.width*0.9 height: 110 x: 15 contentComponent: ListView { id: itemsView clip: true width: parent.width height: 50 model: cache.ui_attribute ? cache.ui_attribute : 0 delegate: Attribute { attributeDecorator: modelData } } }
Das Delegate:
Item { id: attr property AttributeDecorator attributeDecorator property string attrimage : (attributeDecorator.ui_value) ? "yes" : "no" property int widthValue property bool setWidthValue implicitWidth: parent.width implicitHeight: background.height //height: Style.heightDataControls //width: (setWidthValue) ? (widthValue+Style.widthDataControls) : (parent.width/2) - 10 Component.onCompleted: { console.log("Attribute: ",attributeDecorator.ui_id, attributeDecorator.ui_value) } Rectangle { id: background width: parent.width height: 100 color: Style.colourPanelBackground Image { id: image source: "http://www.geocaching.com/images/attributes/"+attributeDecorator.ui_id+"-"+attrimage+".gif" } } }
Könnt ihr mir ein Tip geben warum die Images nicht nebeneinander dargestellt werden bzw. was muss ich da machen?
Danke für Eure hilfe.
gruss
martin -
hi @msauer75
das erste was mir auffällt, ist dass du die Orientierung garnicht auf horizontal gestellt hast.orientation: ListView.Horizontal
der Default ist Vertical.