[Qt-qml] Access to element property
Thomas PABST
thomas.pabst at gmail.com
Fri Feb 25 13:04:06 CET 2011
Hi,
I'm currently trying to get value from an QML element which is the delegate
of a ListView, but the variable cannot be found.
With the function saveData() I would like to get the value from RowElement
where the id is element1. But qmlViewer return a ReferenceError: Can't find
variable: element1.
Is there a way to get it ?
The following example implement only properties necessary to understand the
problem.
thanks
Item {
id: main
property variant data
function saveData()
{
data.value = element1.value;
...
}
ListView {
id: listView
...
model: data
delegate: rowComponent
} // End of ListView id: listView
Component {
id: rowComponent
Column {
id: topRow
RowElement {
id: element1
value: "value1"
}
RowElement {
id: element2
value: "value2"
}
RowElement {
id: element3
value: "value3"
}
}// End of Column id: topRow
} // End of Component id: rowComponent
}
-----------------------------------------------------
Thomas PABST
thomas.pabst at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110225/a74c395f/attachment-0001.html
More information about the Qt-qml
mailing list