Results 1 to 4 of 4

Thread: About QTreeView's shadow.

  1. #1
    Join Date
    Jun 2009
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default About QTreeView's shadow.

    Hi,all

    In my program,I use Treevew.At the front of each Item,there's a icon.
    When you click one item,there will be a shadow.Work as follow:


    But I want it works as follow.I hope the shadow do not cover the icon.


    Could you give me some helps?Thanks a lot!
    Attached Images Attached Images

  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: About QTreeView's shadow.

    You can try using delegates..
    In QItemDelegate, there is a method drawDecoration. To this function you pass a set of option. You can modify those option and set it as unselected so that the blue background is not drawn...

    Am not sure how to do it with QStyledItemDelegate. but it must be something similar

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: About QTreeView's shadow.

    You can implement your own paint() method in delegate where you can use QStyle obtained by QApplication::style() to draw the item view's item background with QStyle::drawPrimitive() with QStyle::PE_PanelItemViewItem where you can pass modified QStyleOption, in your case with modified rect.
    Didn't try but it has chance to work :]
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  4. #4
    Join Date
    Jun 2009
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: About QTreeView's shadow.

    Quote Originally Posted by faldżip View Post
    You can implement your own paint() method in delegate where you can use QStyle obtained by QApplication::style() to draw the item view's item background with QStyle::drawPrimitive() with QStyle::PE_PanelItemViewItem where you can pass modified QStyleOption, in your case with modified rect.
    Didn't try but it has chance to work :]
    Thanks to all replies!!!

    I follow your tips,but has no evolution.
    Could you give me more helps, more details?
    Thanks a lot!!!

Similar Threads

  1. Shadow build QT for the win32-g++ (MinGw) platform.
    By Avrohom in forum Installation and Deployment
    Replies: 0
    Last Post: 21st January 2009, 00:10
  2. QLineEdit shadow text disappear on first entry
    By dentharg in forum Qt Programming
    Replies: 1
    Last Post: 6th July 2008, 18:40
  3. A Shadow of my groupBox
    By baray98 in forum Qt Programming
    Replies: 1
    Last Post: 28th June 2008, 22:41
  4. Desktop application shadow?
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 18th November 2006, 03:42
  5. drawing shadow effect
    By vijay anandh in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2006, 16:41

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.