[Qt-interest] opengl on MDI subwindow?
Rui Maciel
rui.maciel at gmail.com
Thu Nov 19 10:48:22 CET 2009
Bradley Smith wrote:
> It is possible and works fine with 4.6-rc1. What are the errors and
> specifically what changes have you made to install the QGLWidget?
To implement the MDI I've created a new instance of QMdiArea and set it as the main window's central
widget. After that, I've created an instance of glWidget (basically the same class that is provided in Qt's
hellogl example) and added it as a sub-window. So, the main window class' constructor looks a bit like
this:
<code>
{
ui.setupUi(this);
mdiArea = new QMdiArea;
setCentralWidget(mdiArea); // this main window has a Multiple Document Interface
glWidget = new GLWidget(this);
glWidget->setModel(&document.model);
mdiArea->addSubWindow(glWidget);
</code>
After running this code using Qt version 4.5.2 the following error messages appear:
<messages>
QPainter::begin: Cannot paint on a null pixmap
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setPen: Painter not active
QPainter::setBrush: Painter not active
QPainter::setBrush: Painter not active
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::setPen: Painter not active
QPainter::end: Painter not active, aborted
</messages>
Although all these error messages are printed out, the opengl scene renders fine. Nonetheless, as they are
a sign that something is going wrong, it would be nice to fix them.
So, what am I missing?
Rui Maciel
More information about the Qt-interest-old
mailing list