PDA

View Full Version : stop text zooming on QgraphicsItem



prasad.ece2
25th September 2013, 10:40
hi, i have customized QGraphicsItem on scene, i have to display id's on each item (i am displaying the text on item in paint() using qpainter->drawtext() ), when i zoom a item, the text also getting zoom, how can i stop text zooming, so that only my item will zoom but not text .

wagmare
26th September 2013, 05:08
use cosmetic pen to draw Text
it will ignore the scale

http://qt-project.org/doc/qt-4.8/qpen.html#setCosmetic
Cosmetic pens are used to draw strokes that have a constant width regardless of any transformations applied to the QPainter they are used with.

prasad.ece2
27th September 2013, 08:18
no, it is not working. my requirement is, the size of text which i initially draw shouldn't change when i zoom the item .