How to create QGLWidget context after re-parenting it (only since moved to 5.2)?



  • I create a 2 QGLWidget windows. They are working fine until I set parent to one of them.
    For some reason Qt has the following stack when doing that:

    Qt5OpenGLd.dll!QGLContext::reset() Line 203 C++
    Qt5OpenGLd.dll!QGLWidgetPrivate::aboutToDestroy() Line 148 C++
    Qt5Widgetsd.dll!QWidget::destroy(bool destroyWindow, bool destroySubWindows) Line 179 C++
    Qt5Widgetsd.dll!QWidget::destroy(bool destroyWindow, bool destroySubWindows) Line 205 C++
    Qt5Widgetsd.dll!QWidget::destroy(bool destroyWindow, bool destroySubWindows) Line 205 C++

    Qt5Widgetsd.dll!QWidgetPrivate::setParent_sys(QWidget * newparent, QFlags<enum Qt::WindowType> f) Line 277 C++
    Qt5Widgetsd.dll!QWidget::setParent(QWidget * parent, QFlags<enum Qt::WindowType> f) Line 9641 C++
    Qt5Widgetsd.dll!QWidget::setParent(QWidget * parent) Line 9587 C++

    And eventually destroys my context which I find strange since I only set the parent of the widget.
    From the programmer point of view, this is a bug. you do not expect this kind of behavior. my widget is working, I set the parent and it stops working.
    Now that I know that this is a problem, how do I create a new context?
    there is no real function "Create new context"
    And the old "setContext" is deprecated


Log in to reply
 

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