[Qt-qml] PROBLEM : "state" of object inside ListView does not update correctly

jyrki.yli-nokari at nokia.com jyrki.yli-nokari at nokia.com
Sun Jan 30 18:19:25 CET 2011


Use the setProperty http://doc.qt.nokia.com/4.7-snapshot/qml-listmodel.html#setProperty-method
It's not an ordinary JavaScript object.

I.e.  Instead of
"tagColumnModel.get( pos ).tagState = "newState"; "
Do
"tagColumnModel.setProperty(pos, "tagState", "newState"); "
From: ext Francesco Nwokeka <francesco.nwokeka at gmail.com<mailto:francesco.nwokeka at gmail.com>>
Date: Sun, 30 Jan 2011 13:59:57 +0100
To: <qt-qml at qt.nokia.com<mailto:qt-qml at qt.nokia.com>>
Subject: [Qt-qml] PROBLEM : "state" of object inside ListView does not update correctly


Hi guys,

I have a little problem. I can't seem to update the state of my custom button that is inside my delegate. Here is the structure:


// TagColumn

ListView{

ListModel{ id: tagColumnModel }

model: tagColumnModel

delegate: TagColumnDelegate{}

...

...

}


// TagColumnDelegate

Component {

TagButton{

text: tagName

state: tagState

...

...

}

}


when I need to add a tag, I do it with a function that does:

"tagColumnModel.append( { "tagName": newTag, "tagState": "newState" } );


and when i want to modify the state of an object inside my ListModel, i do:

"tagColumnModel.get( pos ).tagState = "newState"; "


but QML doesn't update the button's state with the new one given. Even though when i go read the new state from the model everything is updated.

Do you have any hints on how to do this?


Thanks for your time,

Francesco

_______________________________________________ Qt-qml mailing list Qt-qml at qt.nokia.com<mailto:Qt-qml at qt.nokia.com> http://lists.qt.nokia.com/mailman/listinfo/qt-qml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110130/c2bd1215/attachment.html 


More information about the Qt-qml mailing list