Hi,
I have an item with 12 text fields, laid out as a grid and produced with a repeater.
Now I want to make bindings to one property each (line 29). How can I do that elegantly?
I don't even know which words to use for a google search on this...
I can imagine it might be possible with some kind of list in the property section?
Here's a condensed code that should clarify what I mean:
import QtQuick 2.2
import QtQuick.Controls 1.1
Item {
id: personButtonBasis
property string data00Text: ""
property string data01Text: ""
property string data02Text: ""
property string data03Text: ""
property string data04Text: ""
property string data05Text: ""
property string data06Text: ""
property string data07Text: ""
property string data08Text: ""
property string data09Text: ""
property string data10Text: ""
property string data11Text: ""
Grid {
id: dataTextGrid
columns: 3
Repeater {
id: dataFieldRepeater
model:12
Text {
text: ???????????
}
}
}
import QtQuick 2.2
import QtQuick.Controls 1.1
Item {
id: personButtonBasis
property string data00Text: ""
property string data01Text: ""
property string data02Text: ""
property string data03Text: ""
property string data04Text: ""
property string data05Text: ""
property string data06Text: ""
property string data07Text: ""
property string data08Text: ""
property string data09Text: ""
property string data10Text: ""
property string data11Text: ""
Grid {
id: dataTextGrid
columns: 3
Repeater {
id: dataFieldRepeater
model:12
Text {
text: ???????????
}
}
}
To copy to clipboard, switch view to plain text mode
I tried in vain to "compose" the property name as in this (non-working) example (located starting from line 29):
Binding {
target: personButtonBasis;
property: (index<10)? "data0%1Text".arg(index) : "data%1Text".arg(index)
value: text
}
Binding {
target: personButtonBasis;
property: (index<10)? "data0%1Text".arg(index) : "data%1Text".arg(index)
value: text
}
To copy to clipboard, switch view to plain text mode
It might well be a very stupid question, as I am still very new to the QML world.
Bookmarks