[Qt-interest] Stacked QGraphicsViews
Cyril
cyril.mailing.list at gmail.com
Wed Feb 3 18:02:40 CET 2010
Hi all
I am trying to find a simple and efficient way of "cascading" several
graphicsviews so they draw their contents on one same (possibly OpenGL)
viewport and still.
The goal is to have a few different "transparent layers" on top of each
other, each layer having its own scene and its own transform, and reacting
to user input with specific rules.
The ordering is important since drawing should occur from the bottom-most
layer up to the top-most layer. Same for user input (in opposite order
though): it should be caught by the top-most view first, and then bubbled
down to the second layer if necessary, and so on.
One might think of a game viewport, composed of a game view, staked under a
HUD, stacked under a kind of "menu" overlay.
When it comes to implementation, I have thought of mainly the two following
approaches :
1. Having one master qgraphicsview, then adding qgraphicsproxywidgets on it,
each of them wrapping a qgraphicsview, simply setting the proper z-order.
2. Stacking qgraphicsviews myself on a viewport widget, doing event handling
myself, bubbling the user input events myself, calling
QGraphicsView::render() myself in the right order, and hoping for the best.
This solution is a lot more tricky but offers a lot more control over what's
going on, especially in terms of QPainters creations/destructions. There may
be a lot of caveats going for that one. Not to mention windowing issues.
What may be the best way to go? Are there showstoppers you guys see?
The main reason I want to try a multiple-graphicsview solution is that each
layer should be independent in terms of view transformation. It may also be
nice to simply turn on the drawForeground() method of one of them with a
semi-transparent brush to get the lower layers grayed ; and lots of other
nice features.
Would love to have your opinions!
Regards
Cyril
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100203/40e3e38f/attachment.html
More information about the Qt-interest-old
mailing list