Results 1 to 4 of 4

Thread: Increment a property inside repeater delegate

  1. #1
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Increment a property inside repeater delegate

    HI

    I wanted to incremnet a property inside a repeater delegate or keep the property outside the delegate and increment with in delegate.I do not want to use index property as it is out of my need. Please suggest some good answers quickly
    I am in need of this badly...
    Thanks in Advance
    Here is the snippet:

    Qt Code:
    1. Repeater{
    2. model: 4
    3. property var x
    4. delegate: Button{
    5. x: {var a=0;a;} //i tried this but it says unable to assign undefined to QString and i get binding loop too
    6. text: elements[x] //index wont be helpful for my need
    7. }
    8. }
    To copy to clipboard, switch view to plain text mode 


    Regards
    Beemaneni

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Increment a property inside repeater delegate

    What you want to do doesn't make sense. Why is index unsuitable for you?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Increment a property inside repeater delegate

    It makes sense for my requirement buddy..I have a ListView which has n number of items and each item has a repeater associated with it.Inside the repeater i have a text item where i am reading an array of strings as common for all the items in the listview.So index will be useful only till that repeater where as after that it becomes 0 for the next listview item.i do not want that to become 0 .Hope u will understand my requirement now.


    Regards
    Beemaneni

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Increment a property inside repeater delegate

    Quote Originally Posted by beemaneni View Post
    It makes sense for my requirement buddy..
    I meant it doesn't make sense in a declarative environment.

    I have a ListView which has n number of items and each item has a repeater associated with it.Inside the repeater i have a text item where i am reading an array of strings as common for all the items in the listview.So index will be useful only till that repeater where as after that it becomes 0 for the next listview item.i do not want that to become 0 .Hope u will understand my requirement now.
    The repeater will have its own index.

    javascript Code:
    1. import QtQuick 2.1
    2.  
    3. ListView {
    4. model: 5
    5. width: 300
    6. height: 300
    7. delegate: Column {
    8. property int lvIndex: index
    9. width: 300
    10. Text { text: "ListView index "+lvIndex }
    11. Repeater {
    12. model: 4
    13. Text { text: "Repeater index "+lvIndex+"."+index }
    14. }
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. property binding in a repeater
    By sedi in forum Qt Quick
    Replies: 6
    Last Post: 2nd April 2015, 07:45
  2. Access parent property from repeater
    By c1223 in forum Qt Quick
    Replies: 3
    Last Post: 28th November 2014, 06:11
  3. Replies: 3
    Last Post: 18th June 2013, 22:29
  4. Replies: 1
    Last Post: 23rd June 2012, 13:23
  5. CSS cursor property not working inside QWebView
    By ynonp in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2011, 23:39

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.