Results 1 to 3 of 3

Thread: Custom tree view suggestions

  1. #1
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Custom tree view suggestions

    I've got a project where I'd like to display a time line of events to the user, and I'd like something similar to a tree view since the events need to be categorized. Here is a mockup of what I'm thinking:

    http://img7.imageshack.us/img7/3181/timelinek.png


    My question is: what is the best way to get something like those blue bars in the picture? What seems tricky to me is the blue bars (or whatever) need to span multiple columns. They also would obviously need to scroll with the view contents, and I need them to be selectable separately from the rest of the row, or at least be able to detect when a user clicks one.

    From looking at example code, I can do custom drawing in paintEvent, but what I'm having trouble wrapping my head around is how to determine the coordinates of where the tree nodes and columns are so I can draw those boxes in the right place.

    I have done a good bit of Qt programming in general, but I have zero experience with custom drawing.

    Any suggestions are appreciated!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom tree view suggestions

    Have a lookat delegates.. they are used for custom drawing on trees and lists, etc
    You will need to override QItemDelegate::paint

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

    jtourville (7th May 2009)

  4. #3
    Join Date
    Mar 2009
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom tree view suggestions

    Quote Originally Posted by aamer4yu View Post
    Have a lookat delegates.. they are used for custom drawing on trees and lists, etc
    You will need to override QItemDelegate::paint
    Thanks, I will look into that!

Similar Threads

  1. Custom tree view with checkbox and icon - Plz help
    By ttvo in forum Qt Programming
    Replies: 9
    Last Post: 4th July 2019, 12:51
  2. Radio buttons in a tree view
    By notwithstanding in forum Qt Programming
    Replies: 6
    Last Post: 3rd November 2008, 22:32
  3. Custom Tree paint per row
    By Kal in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2008, 00:19
  4. setSelection() in custom view
    By krudio in forum Qt Programming
    Replies: 13
    Last Post: 6th February 2008, 20:03
  5. Model-view: Creating a custom view
    By taboom in forum Qt Programming
    Replies: 5
    Last Post: 17th August 2007, 20:36

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.