Results 1 to 2 of 2

Thread: Adding SubColumn to the root item in the QTreeView

  1. #1
    Join Date
    Apr 2021

    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
    Brisbane, Australia
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    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, 03:59
  2. Replies: 7
    Last Post: 4th July 2015, 12:41
  3. QTreeView: How to create objects from root items?
    By ficaras0 in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2015, 10:05
  4. Need to remove root node from QTreeView
    By tescik in forum Qt Programming
    Replies: 4
    Last Post: 24th April 2014, 10:54
  5. QTreeView: include root in tree?
    By meter in forum Newbie
    Replies: 2
    Last Post: 14th June 2010, 13:59

Tags for this Thread


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.