tags:

views:

174

answers:

1

Hi,

I am trying to display the items on a graphics scene on two distinct graphics views. My problem is that, I don't want to show all the items on the graphics scene in both views. For example, in my application, on view 1, I will start an editor for the user to draw some items on one view and when the user finishes editing, view 2 will display the newly added item.

Is it possible with one graphics scene?

Sami

+1  A: 

There is not a built-in method to do this as far as i know, but you can do it in the following way:

When you create your items, give that item the pointer of the widget that it will be visible on (lets call this the filter). In the paint() method of item, check if the QWidget* passed as parameter to the paint() method is the same widget given as filter. If they are the same, paint normally. If they are not, do not paint anything. This will give the item visibility in only one view.

The pitfall of this method is that the items may be selectable, movable etc. in all views. This just affects visibility per view. (there may be other issues too, cannot tell without trying)

erelender
maybe it would be a better way to implement the boundingRect() method using your method, so that the item will be visible, selectable and movable in only one of the views.
alisami