seems like delegate.index doesn't work well
Unsolved
QML and Qt Quick
-
when I clicked item, I got a -1 index? can anybody told me what happened?
output:
qml: view.currnetIndex:-1
qml: index:-1
qml: mainRect.currentIndex:0delegate:
Rectangle { height: 102 width: parent.width color: "transparent" MouseArea { anchors.fill: parent; onClicked: { console.log('view.currnetIndex:'+view.currentIndex) console.log('index:'+index) console.log('mainRect.currentIndex:'+mainRect.currentIndex) if (view.currentIndex == index) mainRect.currentIndex = 1; else view.currentIndex = index; } }...
-
How many elements in the model ? Can you show us the view & your model as well ?