Qt resizeGL problem

只愿长相守 提交于 2019-12-11 13:25:45

问题


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.


回答1:


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);


来源:https://stackoverflow.com/questions/5656905/qt-resizegl-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!