Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Use index in a ListView delegate

$
0
0
Hi, i hope you can help me to find out whether i have found a bug or not. I tried to use the index variable in a delegate within a ListView. ListView {     id: selectedItems     width: childrenRect.width     implicitHeight: currentItem ? currentItem.height : 0     clip: true     orientation: ListView.Horizontal     model: breadCrumbModel     delegate: Component {         id: delegateComp         Row {             visible: ListView.isCurrentItem ? !mover.visible : true             id: wrapper             property var wrapperitemdata: (itemdata ? itemdata : parent.itemdata)             Loader {                 sourceComponent: container.separator                 anchors.verticalCenter: breadcrumb.verticalCenter                 height: breadcrumb.height                 visible: (index == 0 ? false : true)                 MouseArea {                     anchors.fill: parent                     onClicked: container.separatorClicked(index)                 }             }             Loader {                 id: breadcrumb                 property var itemdata: wrapper.wrapperitemdata                 sourceComponent: container.breadCrumbDelegate                 MouseArea{                     anchors.fill: parent                     onClicked: container.breadCrumbClicked(index)                 }             }         }     } } This line 130 is relevant: visible: (index == 0 ? false : true) The code works good but i will get error to console: BreadCrumbBar.qml:130: ReferenceError: index is not defined Did i made something wrong?

Viewing all articles
Browse latest Browse all 4972

Trending Articles