[Interest] Embedding QWindow
rap at dlc.fi
Mon Aug 4 20:21:20 CEST 2014
From: Ian Monroe
On Mon, Aug 4, 2014 at 8:28 AM, rap <rap at dlc.fi> wrote:
> > Hello,
> > I'm trying to create an initial OpenGL project for porting some Visual Studio 2010 win32 OpenGL learning stuff to Qt 5.3.1. I
> > wonder
> > if it is somehow possible to embed Opengl classes derived from QWindow as the centralwidget to QMainWindow? So far I have been
> > using
> > a QGLWidget as the centralwidget.
> See the "OpenGL Window Example".
Thanks Ian, I have studied that example but it does not give an answer.
What I'm trying accomplish is to have a MainWindow (derived from QApplication / QWidget) for user input, (buttons etc.) and then a
QWindow derived class as the OpenGL drawing surface and also to be the centralwidget in the MainWindow . However, I haven't been
able to get this to work (probably because QWindow is not a QWidget based class and thus won't be accepted as central*widget*). I
have read that there will be a QOpenGLWidget in future versions that may be just what I'm after, but for now I'm trying to find out
if there is a workaround until that happens.
This is how I have been doing things so far, the myGLWidget is currently QGLWidget based, and now I want/need to replace it with a
QWindow based class. The MainWindow constructor:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
glw = new myGLWidget();
glw->setAttribute( Qt::WA_DeleteOnClose );
All my OpenGL stuff is in the glw instance, using signals from MainWindow/user controls but mouse input directly.
More information about the Interest