[Interest] Qml ListView currentIndex behavior

Nils Jeisecke njeisecke at saltation.de
Tue Aug 6 10:14:14 CEST 2013


Hi,

> If I understand right, in code "model: []" the brackets are a QML list
> and it is empty. In code "view.model = []" the brackets are JS object of
> type Array.
This initialization will (correctly) set currentIndex to -1 initially to:

model: emptyArray()
function emptyArray() { return [] }

So whether it's initially a Javascript Array or a Qml List does not
seem to matter.

> I think the next should work as expected:
>
> ListModel { id: emptyModel }
> ...
> onClicked: view.model = emptyModel
No, it's the same result.

Nils



More information about the Interest mailing list