Results 1 to 9 of 9

Thread: How to assign model roles to delegates

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,369
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to assign model roles to delegates

    Quote Originally Posted by ustulation View Post
    <1> So why isn't it documented?
    It is documented. It is part of Javascript specification where object.property is equivalent to object["property"]. Which also implies by the way that if you have a function "fun" in object "object" you can call it via object.fun() or object["fun"]().

    Ad 2.: m_refModel and modelData[m_roleToUse]
    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.


  2. The following user says thank you to wysota for this useful post:

    ustulation (13th February 2014)

  3. #2
    Join Date
    Jun 2012
    Posts
    58
    Thanks
    13
    Qt products
    Qt4

    Default Re: How to assign model roles to delegates

    It is documented. It is part of Javascript specification where object.property is equivalent to object["property"]. Which also implies by the way that if you have a function "fun" in object "object" you can call it via object.fun() or object["fun"]().
    ooo that was subtle for me. I's too busy thinking of QML syntax that i forgot it's javascript working. Thanks a lot for that !

    m_refModel and modelData[m_roleToUse]
    ya that's what i mentioned in #4. That is clear. What was not clear was your original proposal to use a proxying model somewhere in between (if i understood correctly) m_refModel and Repeater::model which would continue to allow me to use the
    tradational syntax
    as anda_skoa said.

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

    Default Re: How to assign model roles to delegates

    You put a proxy model between a base model and a view. That proxy model can take care of mapping roles based on the base model data and its own role specification.
    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. Replies: 9
    Last Post: 8th November 2016, 06:20
  2. QComboBox roles question
    By mentalmushroom in forum Qt Programming
    Replies: 9
    Last Post: 27th April 2012, 22:04
  3. Proxy Model and Item delegates causing issues
    By snydesc in forum Qt Programming
    Replies: 0
    Last Post: 14th March 2012, 18:17
  4. Combine custom delegate and model data() roles
    By qlands in forum Qt Programming
    Replies: 1
    Last Post: 4th October 2011, 12:43
  5. Getting all roles of specified column and/or model
    By NoRulez in forum Qt Programming
    Replies: 0
    Last Post: 29th April 2010, 11:21

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
  •  
Qt is a trademark of The Qt Company.