I created a form for the application in Qt Designer and placed a QOpenGLWidget in it and got an openGLWidget object, but now I can't figure out how to draw with this object. I will not be able to inherit from the object to write code inside its methods and other things...
How to use the QOpenGLWidget object?
298 Views Asked by mrjbom2 At
2
There are 2 best solutions below
1
On
As the other answer mentions - you can of course create a derived class and use it in a .ui form file. But there's another complementary approach: create a class derived from QObject and install it as an event filter for the widget. In the reimplementation of filterEvent method of that class, you can catch the paint events and other relevant events and act on them.
You are able to inherit from it. You just have to use the widget promotion mechanism in Qt Designer to promote your new
QOpenGLWidgetto your derived type.