Hy there,

i am new to Qt and Creator and have the following problem.

I whant to add an OpenGL QGLWidget to a QGuiApplication that i have created with the new project wizard. Then I add a new QTWidget (QT Designer Form Class) also over the wizard and change

Qt Code:
  1. class gl : public QWidget {
To copy to clipboard, switch view to plain text mode 

to

Qt Code:
  1. class gl : public QGLWidget {
To copy to clipboard, switch view to plain text mode 

in .h and .cpp

i alos add

Qt Code:
  1. #include "QGLWidget"
To copy to clipboard, switch view to plain text mode 

in the .h file

Now i need to create a new instance of my class here and connect it to the ui

Qt Code:
  1. GLTest::GLTest(QWidget *parent)
  2. : QMainWindow(parent), ui(new Ui::GLTest)
  3. {
  4. // have to add it here
  5. ui->setupUi(this);
  6. // or here and how ?
  7. }
To copy to clipboard, switch view to plain text mode 

But i do not get it to work.
Can you give me an smale example?
I know that i have to add it to the CentraWidget.