Results 1 to 8 of 8

Thread: Problem representing/drawing c++ tree-like structure via qt quick.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Problem representing/drawing c++ tree-like structure via qt quick.

    Quote Originally Posted by flashmozzg View Post
    But I the roles/properties aren't fixed. And you can only specify and access fixed roles.
    The third example is obviously not using a fixed role.

    Cheers,
    _

  2. #2
    Join Date
    Feb 2015
    Posts
    23
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Problem representing/drawing c++ tree-like structure via qt quick.

    Quote Originally Posted by anda_skoa View Post
    The third example is obviously not using a fixed role.

    Cheers,
    _
    This one 'var key = "text";' ?
    How so? How it's even equivalent to 'var bar = model["text"]' ?
    And even the model.text would change model properties. Whereas If I understood correctly model element's properties inside delegate can only be accessed if they are declared as roles.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Problem representing/drawing c++ tree-like structure via qt quick.

    Quote Originally Posted by flashmozzg View Post
    This one 'var key = "text";' ?
    No, the third example for accessing the model data
    Qt Code:
    1. var baz = model[key]
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by flashmozzg View Post
    And even the model.text would change model properties. Whereas If I understood correctly model element's properties inside delegate can only be accessed if they are declared as roles.
    Well, if your names are not model roles, return the object as one of the model roles and access the object's properties by name.

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 3rd October 2011, 16:40
  2. Replies: 6
    Last Post: 20th May 2011, 18:56
  3. QStandardItemModel, parent / child to form tree structure
    By Nightfox in forum Qt Programming
    Replies: 2
    Last Post: 8th January 2010, 18:01
  4. Tree structure
    By ikm in forum Newbie
    Replies: 1
    Last Post: 7th August 2009, 21:19
  5. Create Tree Structure
    By bismitapadhy in forum Qt Programming
    Replies: 4
    Last Post: 4th June 2009, 11:13

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.