Results 1 to 3 of 3

Thread: Merge columns in QTreeView

  1. #1
    Join Date
    Jul 2008
    Posts
    434
    Thanks
    9
    Thanked 57 Times in 55 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

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

    Default Re: Merge columns in QTreeView

    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.


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

    Ginsengelf (3rd September 2014)

  4. #3
    Join Date
    Jul 2008
    Posts
    434
    Thanks
    9
    Thanked 57 Times in 55 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Merge columns in QTreeView

    Thanks, in german I would say "Tomaten auf den Augen".

    Ginsengelf

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.