[SOLVED] Reference error in ListView highlight component
-
I'm feeling as if I've started using Qt Quicks just 20 minutes ago...
The following trivial code does not work.
I cannot reference from the highlight component to the ListView that is in the same scope.
Either I'm totally blind or there is actually something wrong inside Qt (4.8.1). I would appreciate any help!
Main.qml
@
import QtQuick 1.1Column {
width: 300
height: 300Reel {
id: reelInstance // setting some local id here
}
}
@Reel.qml
@
import QtQuick 1.1ListView {
id: reel
width: 100
height: 100property string someProperty: "Bla!"
highlight: Text {
// results in "ReferenceError: Can't find variable: reel"
text: ">>> " + reel.someProperty
}delegate: Text {
// interestingly: this works as expected
text: "M " + reel.someProperty + " - " + modelData
}model: 10
}@
-
I see the same behavior in both 4.8.1 and 4.7.4. (Doesn't work for me either.)
I don't know. Seems like that should work.
-
I also think that it should work. I've filed a bug:
-
This is fixed with d25fc4c63fa4512aa1cfc5ce3877e4d8632b3fec.
Thanks!
-
Hello,
Anyone knows of a workaround for this issue. I would like it to work on the 4.8.1 version with no modification. Thank you.
Bill
-
You can use the ListView.view attached property.
-
Exactly what I needed, thank you so much Njeisecke!
Bill
-
Yeah, we Ant Farmers must stick together ;-)