views:

103

answers:

1

Qt's graphics view frameworks is very powerful, but I have not found a way to support custom layers. In Qt, there is a QGraphicsScene::ItemLayer,but QGraphicsScene renders all items are in this layer. I want manage the items with several layers, Just like Illustrator and CorelDraw. all the item only in the current layer will receive the event, be selected or get the key focus etc.. Other layers(not current layer) will not receive all scene event. The most reasons of using layers is I could catalogue a large number of items more clearly.And without needing transfer events to all the layers' items ,I think the graphics frameworks will be more efficient. The last question, does QGraphicsView support rendering server stacked graphics scenes at the same time? If support, I think the "custom layers" can be solved in this way. Thanks very much!

+1  A: 

I can see 2 ways of achieving layering of items:

  • You can use QGraphicsItemGroup to group items.
  • Or put items of same "layer" into a parent QGraphicsItem that does not draw anything.
Stephen Chu
Thanks very much, I will try the QGraphicsItemGroup class.
jnblue
No problem. If it works for you, It'll be appreciated if you accept or up vote this answer. :)
Stephen Chu