Results 1 to 3 of 3

Thread: Merge columns in QTreeView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    512
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Merge columns in QTreeView

    Hi, I have a QTreeView with a QStandardItemModel. Since the entries in the top level items can be a little long (and all columns except the first one are empty) I would like them to use the space of the other columns as well instead of just the first column:
    This is what I've got:
    Qt Code:
    1. Col1 | Col2 | Col3
    2. >Top_Le... |
    3. >0 | 1 | 2
    4. >3 | 4 | 5
    5. >6 | 7 | 8
    To copy to clipboard, switch view to plain text mode 
    This is what I want:
    Qt Code:
    1. Col1 | Col2 | Col3
    2. >Top_Level_With long_Text
    3. >0 | 1 | 2
    4. >3 | 4 | 5
    5. >6 | 7 | 8
    6. >2nd_Top_Level_With long_Text
    7. >0 | 1 | 2
    8. >3 | 4 | 5
    9. >6 | 7 | 8
    To copy to clipboard, switch view to plain text mode 
    In QTableView there is a method to set span on the cells, but I haven't found anything similar in QTreeView. I could use QTableView, but I like the expanding/collapsing feature of the tree.

    Ginsengelf
    Last edited by Ginsengelf; 3rd September 2014 at 07:17. Reason: reformatted to look better

Similar Threads

  1. QTreeview Columns lengths
    By kiran p in forum Qt Programming
    Replies: 0
    Last Post: 18th April 2011, 13:12
  2. Replies: 1
    Last Post: 12th October 2009, 09:33
  3. How to merge QTableView and QTreeView ???
    By Xaleandr in forum Newbie
    Replies: 2
    Last Post: 29th December 2007, 17:58
  4. Moving columns/hiding columns in QTreeView
    By yogeshm02 in forum Qt Programming
    Replies: 4
    Last Post: 14th March 2007, 16:22
  5. [qt4 & Xp] resize columns of a QTreeView
    By incapacitant in forum Newbie
    Replies: 4
    Last Post: 2nd March 2006, 14:06

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.