Using QGraphicsView/QGraphicsScene/QGraphicsItem, I need to create multiple views of another QGraphicsItem.
In other words, within QGraphicsScene I need to create multiple QGraphicItems which display portions of some other QGraphicsItem which is stored somewhere offscreen. It is kind like model/view framework, where one QGraphicsItem acts like a model, and other QGraphicsItems act like views - displaying (clipped) portions of that other item. (see attached picture)
How can I do that? Please note that "views" should not be read-only. Each view should react to mouse movements, keyboard input and should redraw itself properly when some items within the model change.
The dumbest way to do it would be to draw hidden item onto QImage and then display portions of that QImage within other items. HOwever, that would mean a lot of wasted memory. Is there any other way to do it?
Qt 4.8, VC2008 express, Windows platform.
--EDIT--
I need to display portions of the scene (or offscreen QGraphicsItem) within the scene. It is kinda like portals in 3d games.
QGraphicsItem
? I would design it in a way where the "model" is a plain C++ (probably a Qt-)-object which provides the necessary data, so that each "view"QGraphicsItem
can fetch the relevant data and paint it accordingly – Andreas Festerpaint()
method of the model items from your view item'spaint()
method, and set a proper translation transformation before (and probably set theItemClipsToShape
flag on the view items)? – Andreas Fester