Qt resizeGL problem

2019-07-28 04:30发布

I'm writing a simple program where i have only one widget QGLWidget. I initialize it in constructor of my main class like this:

 view3d = new GLBox(this);

The view3d object is displayed properly but the problem is that the method resizeGL works only once - when the obejct is being created. After that it doesn't run when I change the size of the window. I used qDebug() function to chcek this and as I said it works only one time. I declared resizeGL as a protected method. Do you maybe know what can cause this problem? Thanks for your answers.

标签: qt qt4
1条回答
淡お忘
2楼-- · 2019-07-28 05:23

You should add your view3d widget into parent's layout. E.g.

view3d = new GLBox(this);
QVBoxLayout *box_layout = new QVBoxLayout;
box_layout->addWidget(view3d);
this->setLayout(box_layout);
查看更多
登录 后发表回答