I have a OpenGL widget inside the MainWindow.
I'd like to access MainWindow from its code.
I've tried it with the qApp->activeWindow()
and findChild()
combo but it does not work.
The WidgetOpenGLDraw constructor looks like:
WidgetOpenGLDraw::WidgetOpenGLDraw(QWidget* parent):QOpenGLWidget(parent),gl(nullptr){}
EDIT1>
This also crashes: ((MainWindow*)qApp->activeWindow())->fname_here();
.