c++qttransformationqgraphicsviewqgraphicsscene

Prevent scaling an item when scaling the view rect


I am using Qt's QGraphicsView — and QGraphicsItem — subclasses.

Is there a way to not scale the graphical representation of the item in the view when the view rectangle is changed, e.g., when zooming in. The default behavior is that my items scale in relation to my view rectangle.

I would like to visualize 2d points which should be represented by a thin rectangle which should not scale when zooming in the view. See a typical 3d modelling software for reference, where vertex points are always shown at the same size.


Solution

  • Set the QGraphicItem's flag QGraphicsItem::ItemIgnoresTransformations to true does not work for you?