Results 1 to 3 of 3

Thread: How to implement a list with varying column headers with a QTreeVieew in Qt4

  1. #1
    Join Date
    Jan 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How to implement a list with varying column headers with a QTreeVieew in Qt4

    I am trying to build a windows explorer like application with Qt4. On the left side there is a tree, the right side contains a list. The list uses a QTreeView to display the columns. My problem are the column headings: depending on the selected node in the tree there are distinct column headers in the list. Since QAbstractItemModel::headerData has no dependency on a QModelIndex (like columnCount), my solution was to let headerData return the union of all possible column headers and to hide the ones that are not needed for the current node( with a class derived from QHeaderView). There remains on problem: the sequence of columns is the same for all nodes (I can’t have “Name|Color|Size” for one node and “Color|Name|Date” for another). Has anybody implemented something like that and knows a solution?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to implement a list with varying column headers with a QTreeVieew in Qt4

    A filter or delegate would problably work.
    You might want to create some user defined data (user roles) that let the delegate (for example) know how to arange the columns.

  3. #3
    Join Date
    Jan 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to implement a list with varying column headers with a QTreeVieew in Qt4

    Quote Originally Posted by tbscope View Post
    A filter or delegate would problably work.
    You might want to create some user defined data (user roles) that let the delegate (for example) know how to arange the columns.
    Can you elaborate on that?

Similar Threads

  1. list tables column name (database)
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 26th September 2012, 11:18
  2. List View with sections for alphabetialy sorted list
    By woodtluk in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2010, 11:50
  3. QTableView + column span of headers
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 11th November 2009, 14:29
  4. Replies: 4
    Last Post: 26th October 2009, 22:25
  5. make QTableView work as a multi-column list view
    By wesley in forum Qt Programming
    Replies: 1
    Last Post: 11th March 2008, 14:43

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.