Using Qt3D features in a QMdiArea



  • Is the topic reasonable? I have an app that I want to write a plugin for that spawns a Qt3D window into the main application's QMdiArea as a QMdiSubWindow. Ideally, I would want to write this in such a way that I can also port the code for use on mobile devices (meaning that there would be no QMdiArea).

    The first obstacle I see is that Qt3D code doesn't use widgets at all - it uses QWindow. I think I can get away with using QWidget::createWindowContainer(), but there's warnings all over the place that this will have a major performance impact, and my attempt at using it gives me the following error:

    @Could not create requested format:
    QSurfaceFormat(version 2.0, options QFlags() , depthBufferSize 24 , redBufferSize -1 , greenBufferSize -1 , blueBufferSize -1 , alphaBufferSize -1 , stencilBufferSize -1 , samples -1 , swapBehavior 2 , profile 0 )
    got format:
    QSurfaceFormat(version 3.3, options QFlags(0x4) , depthBufferSize 24 , redBufferSize 8 , greenBufferSize 8 , blueBufferSize 8 , alphaBufferSize 0 , stencilBufferSize 0 , samples -1 , swapBehavior 2 , profile 0 )
    Attempt to activate invalid window surface
    Maybe set the window size, eg view.resize(800, 600)..?
    ASSERT failure in QGLPainter: "begin() has not been called or it failed", file /home/rich/tmp/depot/qt5/qt3d/src/threed/painting/qglpainter.cpp, line 1018
    The program has unexpectedly finished.@

    Would I be better off spawning a QWindow outside of the QMdiArea and giving up allowing it to be managed by the main application?

    I've been looking forward to using lots of the Qt3D capabilities like camera control and model loading.



  • Hi kshots,
    I came across your post because I had a very similar issue using a GL window with a winow container. What finally worked for me is to set both the size of the gl window and the size of the container fixed (e.g. 600x800).
    If you have been able to find a better way in the meantime it would be very nice of you to share it!


Log in to reply
 

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