[Qt-interest] QGLWidget: initializeGL not executed

Oliver Demetz forenbeitraege at oliverdemetz.de
Wed May 27 14:09:45 CEST 2009


Hi!

I've got a QGraphicsView and scene, and the viewport of my vie is an 
QGLWidget. Everything works fine, also I am sure that the OpenGL 
subsystem is definitely used.

Now I want to use my own subclassed QGLWidget as the viewport in order 
to check some properties of the opengl subsystem:

Instead of

     my_view.setViewport(new QGLWidget(...));

I state

     my_view.setViewport(new GLWidget(...));

where my GLWidget is:

class GLWidget : public QGLWidget
{
public:
	GLWidget(const QGLFormat & format, QWidget * parent = 0, const 
QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0 )
	: QGLWidget(format, parent, shareWidget, f)
	{

	}
protected:
	void glInit()
	{
		QGLWidget::glInit();
		qDebug() << "glinit";
	}
	void initializeGL()
	{
		QGLWidget::initializeGL();

		QString strextensions((char*)glGetString(GL_EXTENSIONS));
		QStringList extlist = strextensions.split(" ");
		foreach(QString s, extlist)
			qDebug() << s;

	}
};

If I execute the code, I would expect to see at least the list of 
extensions or the debugstring "glinit".

BUT NOTHING APPEARS!!!
why are thos methods not executed?????

Note that the functionality still is as it was with the original QGLWidget!
Only the functions are not executed (also not paintGL).

Thanks in advance,
Olli



More information about the Qt-interest-old mailing list