[Qt-interest] QGraphicsTextItem Dotted rectangle.

André Somers andre at familiesomers.nl
Sat Aug 29 14:46:28 CEST 2009


On Friday 28 August 2009 05:03:23 pm manish.s.sharma at nokia.com wrote:
> Hi All,
>
> I am creating a QGraphicsTextItem. I am making it editable by setting
> appropriate interaction flag. When I click on this textitem it gets
> highlighted and a dotted rectangle is drawn around the peripheral of the
> text item.
>
> Is it possible to remove this dotted rectangle? Please see in below pic.

It should be...
The way I would go about this, is to subclass QGraphicsTextItem. Reimplement 
the paint() method. In your reimplementation, you can modify the style options 
to your liking, and then simply call the base implementation. I am not exactly 
sure what style option to modify, probably you need to (un)set one of the flags 
set in the state variable.
This way, you won't have to reimplement the actual drawing yourself :-)

Still: while I have done similar things with item views in the past, I have 
not tried this technique on QGraphicsView's. YMMV.

I hope that helps?

André







More information about the Qt-interest-old mailing list