Results 1 to 2 of 2

Thread: Adding SubColumn to the root item in the QTreeView

  1. #1
    Join Date
    Apr 2021
    Posts
    27
    Thanks
    5

    Default Adding SubColumn to the root item in the QTreeView

    I have implemented a QTreeView using the SimpleTreeModel example.

    But now I want to add two sub-columns in one root item. For example, Entries "item A" and "Value" will be inside one root entry "Data A". Similarly Entries "item B" and "Value" will be another root entry "Data B".

    Can anybody tell how it can be done?

    Thanks in advance
    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,734
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Adding SubColumn to the root item in the QTreeView

    You either change your custom model to present the tree structure that way, or you overlay a QAbstractProxyModel sub-class to do this rearrangement in the fly. Which you choose will depend on where else the model might be used and what your are trying to achieve.

Similar Threads

  1. Replies: 0
    Last Post: 27th August 2018, 02:59
  2. Replies: 7
    Last Post: 4th July 2015, 11:41
  3. QTreeView: How to create objects from root items?
    By ficaras0 in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2015, 09:05
  4. Need to remove root node from QTreeView
    By tescik in forum Qt Programming
    Replies: 4
    Last Post: 24th April 2014, 09:54
  5. QTreeView: include root in tree?
    By meter in forum Newbie
    Replies: 2
    Last Post: 14th June 2010, 12:59

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.