jnblue
jnblue

Reputation: 279

How can let Qt Graphics View Framework support custom layers

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!

Upvotes: 2

Views: 1667

Answers (1)

Stephen Chu
Stephen Chu

Reputation: 12832

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.

Upvotes: 4

Related Questions