qt - Using items in the background of a QGraphicsScene -
I have QGraphicsScene where I initially attracted the background in the drawBackground () function. However, this requires a lot of calculation and got very slow, so I made a bunch of items instead. Its expected speed was
My question: Is there any way to treat these items as background? Does it make a difference if I understand them as a background?
Thanks
There are three layers in reference to QGraphicsScene (see Qt Docs) :
- QGraphicsScene :: ItemLayer
Item layer QGraphicsScene calls all layers in this layer by calling the virtual function drawItems (). The item layer is prepared after the background layer, but before the foreground layer.
- QGraphicsScene :: BackgroundLayer
Background layer The QGraphicsScene virtual function renders the background of the view in this layer by calling the DrawBackground (). The background layer is drawn on all the layers first.
- QGraphicsScene :: Foreground Layer
Foreground Layer QGraphicsScene Virtual Function By calling drawForeground () the foreground of the view in this layer Underlines. The foreground layer is the last withdrawal of all the layers.
Earlier, there is no legal way to place items in the background layer, however, you can use QGraphicsItem sorting to keep some items behind others To display them as background .
Comments
Post a Comment