Thanks for the suggestion Gunnar!  A question, though: I'm using  
QStyledItemDelegate, and it doesn't have the drawFocus method which  
QItemDelegate does.

Based on this suggestion, I'm guessing that the equivalent approach  
there would be to be to implement a custom Style, and have  
drawPrimitive for QStyle.PrimitiveElement PE_FrameFocusRect do  
nothing.  Does that make sense, or is there a quicker way to  
accomplish this that I'm not seeing?

thanks!
-phil



On Jul 21, 2009, at 1:47 AM, Gunnar Sletta wrote:

> Phil Mc wrote:
>> Hi all -
>> a question I've been stumped on, and Googling the Qt mailing lists  
>> isn't
>> turning up much that's useful: what's the best way to draw a  
>> QTableView
>> without the focus rectangle appearing?  The goal is to set a  
>> background
>> color for an active row (which is simple enough with stylesheets  
>> and a row
>> selection behavior!) but to avoid having the focus rectangle drawn  
>> on top
>> of that.
>> Clearing the selection model or otherwise removing focus after the  
>> row's
>> been drawn removes the focus rectangle, but it also disables key
>> navigation...
>
> The drawing of each individual cell is handled by the QItemDelegate  
> class. If you override the virtual drawFocus() function to do  
> nothing, then you can avoid the focus rect.
>
> best regards,
> Gunnar

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to