[SOLVED] QML Qt.createQmlObject how to refer variable
-
Hi all. I have a QML & JavaScript code:
@ Grid {
columns: 4
y: 50
id: grid
spacing: 50
function pokaz() {
for(var j = 0; j < 5; j++) {
Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.nazwa(j)}', grid, '');
Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.cena(j)}', grid, '');
Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.sztuk(j)}', grid, '');
Qt.createQmlObject('import com.nokia.meego 1.1; Label {text: wydatek.data(j)}', grid, '');
}
}
Component.onCompleted: pokaz();
}@
I can't to refer 'j' value. I have a log:
@ <Unknown File>:1: ReferenceError: Can't find variable: j@
Question is: How can I refer the 'j' value? How I do wrong? -
@
'import com.nokia.meego 1.1; Label {text: wydatek.nazwa(' + j + ')}'
@