Results 1 to 7 of 7

Thread: property binding in a repeater

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    159
    Thanks
    69
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Question property binding in a repeater

    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:

    Qt Code:
    1. import QtQuick 2.2
    2. import QtQuick.Controls 1.1
    3.  
    4. Item {
    5.  
    6. id: personButtonBasis
    7.  
    8. property string data00Text: ""
    9. property string data01Text: ""
    10. property string data02Text: ""
    11. property string data03Text: ""
    12. property string data04Text: ""
    13. property string data05Text: ""
    14. property string data06Text: ""
    15. property string data07Text: ""
    16. property string data08Text: ""
    17. property string data09Text: ""
    18. property string data10Text: ""
    19. property string data11Text: ""
    20.  
    21.  
    22. Grid {
    23. id: dataTextGrid
    24. columns: 3
    25. Repeater {
    26. id: dataFieldRepeater
    27. model:12
    28. Text {
    29. text: ???????????
    30. }
    31. }
    32.  
    33. }
    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):
    Qt Code:
    1. Binding {
    2. target: personButtonBasis;
    3. property: (index<10)? "data0%1Text".arg(index) : "data%1Text".arg(index)
    4. value: text
    5. }
    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.
    Last edited by sedi; 22nd March 2015 at 12:56.

Similar Threads

  1. repeater polish() loop on ios
    By joko in forum Qt Quick
    Replies: 8
    Last Post: 13th March 2015, 15:35
  2. Access parent property from repeater
    By c1223 in forum Qt Quick
    Replies: 3
    Last Post: 28th November 2014, 06:11
  3. Dynamic QML Property Binding
    By EMCEE in forum Qt Quick
    Replies: 1
    Last Post: 30th August 2012, 11:51
  4. QML Property Binding update does not propagate
    By bluestreak in forum Qt Quick
    Replies: 0
    Last Post: 21st August 2012, 19:24
  5. Replies: 0
    Last Post: 17th October 2011, 13:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.