Results 1 to 3 of 3

Thread: Tree View Item selected rectangle

  1. #1
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Tree View Item selected rectangle

    Hello - can anyone tell me what style element controls the drawing of the dotted border around the item in a TreeView when the item is selected? I need to change the left edge of the rectangle and I can't figure out what controls the size! I have an Item Delegate already and have overridden the Paint function... this is the only piece left. Thanks in advance for any help.

  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: Tree View Item selected rectangle

    The dotted border is the focus frame...
    so if you disable the QStyle::State_HasFocus flag, you wont get the dotted border. You can then draw your own rect then

  3. #3
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Tree View Item selected rectangle

    Thanks so much for your quick reply. I understand the theory behind your answer, and sorry to be dense.... but how do you disable this flag? I thought I could interrogate QStyle::State_HasFocus using the StyleOption passed into the Paint function and then just put in my own drawPrimitive for the focus rectangle. But I don't ever get a "true" on State_HasFocus. Not sure of another way to turn of the default drawing and do my own. Or pass it a different rectangle. Do you have another suggestion to try?

Similar Threads

  1. How change selected item rectangle on QGraphicsScene
    By xray2000 in forum Qt Programming
    Replies: 1
    Last Post: 18th May 2010, 16:43
  2. popupmenu for QTreeWidget's item when a particular item selected.
    By vinod sharma in forum Best Practices in Qt Programming
    Replies: 1
    Last Post: 22nd January 2010, 10:45
  3. how to zoomin the selected rectangle?
    By lengshuang in forum Qt Programming
    Replies: 0
    Last Post: 25th April 2009, 02:42
  4. QGraphicsView : change selected rectangle style
    By kghose in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2008, 18:12
  5. Replies: 14
    Last Post: 9th November 2006, 08:35

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.