Fixed overlay transformations in QGraphicsView

In the Qt-based application that I am developing, I use QGraphicsView to display sensor data in a 2D grid. On the side, I would like to show a legend / palette in order to associate the colors in the grid with the values.

The user can scale and pan the view of the sensor data, but it is clear that the palette should be fixed in the view. Therefore, placing a palette / legend in a scene with a touch representation requires extra caution: applying an inverse user transform.

However, I would prefer the palette / legend to be implemented as a kind of (non-interactive) layer with its own transformation. Is it possible?

+3
source share
3 answers

I think you should implement the legend / palette overlay from the QGraphics context, if you move (setPosition ...) this element to invert the custom transform, the element will be re-indexed in the graphics tree anytime you pan / zoom .. .

, , , , , QGraphicsView (wicth - ) paintEvent, / ( ). , / , pixmap pixmap , QGraphicsView (, ...).

, .

+2

( ..), Qt 4.8.5 Qt 5.2.1:

  • QGraphicsView
  • drawForeground (QPainter *, const QRectF &)
  • painter- > resetTransform() , -
  • QPainter , QWidget

- , .

+2

, , , QGraphicsItem QGraphicsItem:: ItemIgnoresTransformations, .

+1

All Articles