PDA

View Full Version : The best way to having 'cad layers' at Graphics scene-view ?



tonnot
28th November 2011, 18:42
As Up I know I cant have some sceneviews to paint at the same GraphicsView.
To 'emulate' the 'cad layers' concept, what can be best ?
- Can I try to have some Graphicsview, ones above other ? (using transparent backgrounds)
- Have I to think on Pixmap & render strategy ? (draw data to pixmaps and send them to the view ?
Any idea will be useful . Thanks

d_stranz
28th November 2011, 19:18
Make each layer a QGraphicsItem, and set its zValue to be the layer number (so the zValue for layer 0 is 0.0, which means it is at the bottom of the display stack, zValue for layer 1 is 1.0, etc.). Then, for each layer, add child QGraphicsItems to the QGraphicsItem for that layer. QGraphicsItems are drawn with lowest zValue first, so if a QGraphicsItem with higher zValue overlaps a lower one, it will hide it if it is not transparent.

To display only a single layer, setVisible = false for all other layers. To make an upper layer "hide" layers below it, setOpacity = 1.0. To make all layers show from the bottom up, setOpacity = 0.0 for all layers.