PDA

View Full Version : Tree View Item selected rectangle



LynneV
27th May 2010, 23:35
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.

aamer4yu
28th May 2010, 07:18
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 :)

LynneV
28th May 2010, 16:17
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?