Results 1 to 2 of 2

Thread: Embed rows of icons in a QTreeView?

  1. #1
    Join Date
    Apr 2006
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Embed rows of icons in a QTreeView?

    Hey I'm wondering what is the best way to go about something with a QTreeView. I have a treeview where some of the items contain "regular" lists of things, but others contain a bunch of icons, kind of like a IconView.

    These can't each be on their own line like, otherwise Treeview would support it easily. Here's a mockup of more or less what it should look like:


    (those would just be regular QIcons -- they happen to be chopped from screenshots of a 3d view but they are not 3d or anything)

    What do you Qt experts think the best way of doing this would be? It would be nice if the icons behaved like the rest of the items in the model, but I would be OK with just having one big item that embedded an icon view somehow..

    Any advice? Or examples of similar code out there?

    thanks!
    Joel

  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: Embed rows of icons in a QTreeView?

    This is perfectly possible and actually not that difficult, although it takes a little bit of code.

    You need to create a custom delegate and implement the paint and sizehint functions.
    Using some event filters too, you can make it so that you can select one single item too.

    Try creating such a delegate yourself. If you get stuck or don't know how to proceed, post the code you have so far and I or someone else will help you out.

Similar Threads

  1. Fetching rows in QtreeView
    By visor_ua in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2008, 18:17
  2. QTreeView rows (items) StyleSheet
    By Kostanev in forum Qt Programming
    Replies: 1
    Last Post: 15th September 2007, 10:36
  3. QTreeView rows editable
    By Pesho in forum Qt Programming
    Replies: 5
    Last Post: 13th September 2007, 13:19
  4. (Qt 4) QTreeview and Icons?
    By pinktroll in forum Qt Programming
    Replies: 4
    Last Post: 17th August 2006, 16:06
  5. [Qt 4.x] Highliting rows in a QTreeView
    By Moppel in forum Qt Programming
    Replies: 3
    Last Post: 10th March 2006, 10:00

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.