[英]Add QWidget on top of QOpenGLWindow
I want to add QWidget on top of my QOpenGLWindow. 我想在QOpenGLWindow的顶部添加QWidget。 For example:
例如:
In qmainwindow.cpp: 在qmainwindow.cpp中:
QWidget *mywidget = new QWidget(this);
mywidget->hide();
QOpenGLWindow *glwindow = new QOpenGLWindow();
QWidget *container = QWidget::createWindowContainer(glwindow, this);
// ...
ui->tabWidget->addTab(container, "Container");
// then I want mywidget to be at the top of my tabWidget and container.
mywidget->show();
But mywidget is behind the container . 但是mywidget在容器后面。
How can I solve this problem? 我怎么解决这个问题?
Qt cannot divine what Z order you want if you don't create the widgets in Z order. 如果您不按Z顺序创建小部件,则Qt无法确定您想要的Z顺序。 You need to
raise
the widget. 您需要
raise
小部件。 The whole hiding rigmarole is completely unnecessary anyway. 无论如何,整个隐藏的僵尸都是完全不必要的。 Simply create the widget where you need it.
只需在需要的地方创建小部件即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.