Jens
Uncategorized
Qt
Posted by Jens
 in Uncategorized, Qt
 on Wednesday, May 30, 2007 @ 10:51

vista delegate

Vista introduced a new optional “Explorer” style for some of its item views. While Qt 4.3.0 uses this style for its item view classes, the selection background of the the delegate itself still retains the appearance from XP since it is not currently decorated by the style. While we consider revising this for a future version of Qt, it is in fact already possible to get the themed selection backgrounds by using the following custom delegate as shown in our modified dirview example above. The image below shows the same application without row selection and a single column.

vistadelegate.h
vistadelegate.cpp

single column tree

A few notes about this delegate:
- It requires the Vista SDK and must be linked against gdi32.lib, but it should not have extra runtime dependencies.
- On platforms other than Windows Vista the standard item delegate decorations are used.
- It is primarily designed for tree views, but can be used with other views as well.
- Hover appearance is currently disabled when row selection is used since it would require some extra updates from the widget.

4 Responses to “Explorer style tree views on Vista”

» Posted by Chris B
 on Wednesday, May 30, 2007 @ 10:56

Both links go to vistadelegate.h.

» Reply from Jens
 on Wednesday, May 30, 2007 @ 11:05

Thanks. Corrected now.

» Posted by AlKu
 on Wednesday, May 30, 2007 @ 12:57

Wow, that’s awesome! Thank you.
I’d probably now start to dig the Doc to find a way to provide the Hover feature, so I better ask before I start to write 1000 lines for this - does it require alot of work (for me) to implement the hover feature? If so (or not), can you point me to the right direction?

» Posted by AlKu
 on Thursday, May 31, 2007 @ 10:48

Oh, never mind. I just noticed that tree views do get hover effects and that’s all I need for now :) Though your code should also maybe check if QWindowsVistaStyle is used so that it doesn’t interfere with custom styles or the other styles… just a thought :)



© 2008 Nokia Corporation and/or its subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation in Finland and/or other countries worldwide.
All other trademarks are property of their respective owners.