QGraphicsScene offscreen rendering



  • Hi,

    I'm using a QGraphicsScene for the layout of various objects. This scene is basically rendered in a QGraphicsView but I would like to support also something like an offscreen rendering at this level (actually I want an accessible memory representation). The QGraphicsView has a setViewport method and I suspect that I should use it, but the method expects a QWidget where I would like to use something like a QPixmap (another QPaintDevice derived class). Is it the right direction? or not... Any solution would be appreciated.
    I'm a bit confused by the number of classes and the lack of concise synthetic view of the class hierarchy.
    By the way, is there any graphic class hierarchy chart for the 4.7 version ? (I've found one but for QT 3.2).



  • You might not need setViewPort here. One could set multiple views to a single scene.

    You can accomplish your off screen functionality by using fitInView (to show only the rect that you are interested in) and by setting the scrollbar policies to be off



  • [quote author="chetankjain" date="1291049448"]You might not need setViewPort here. One could set multiple views to a single scene.[/quote]

    I know that I can get multiple views but I want to switch between a standard view and an offscreen view.

    [quote author="chetankjain" date="1291049448"]You can accomplish your off screen functionality by using fitInView (to show only the rect that you are interested in)
    [/quote]

    that's already how the view works.

    Maybe I should explain more what I want to do: actually I've developed a viewer using Qt which main services are implemented in a shared library built using Qt for the graphic part. I want to make these services available in Java thru a JNI library. Since only the graphic result is important, my idea is to draw offscreen and to copy the resulting bitmap to the java environment. Thus the final graphics destination could be a standard QGraphicsView in case of a Qt application or a memory bitmap in case of Java.
    (Sorry, maybe I should have started with these explanations)

    If you want to know more about the viewer, see the "INScore project":http://inscore.sourceforge.net



  • try next functions:

    @void QGraphicsView::render (...)
    void QGraphicsScene::render(...)@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.