【发布时间】:2019-08-11 13:51:20
【问题描述】:
我想在 Qt3DWidget 之上拥有一个或多个 QPushButtons 或其他小部件,但它是不可见的。不知道为什么。
在我的 mainwindow.cpp 中有这样的代码:
this->renderer = new Qt3DExtras::Qt3DWindow();
this->renderer->defaultFrameGraph()->setClearColor(QColor(QRgb(0x4d4d41));
this->rendererContainer = QWidget::createWindowContainer(this->renderer);
ui->centralWidget->layout()->addWidget(this->rendererContainer);
this->shotButton = new QPushButton("Make photo", this->rendererContainer);
this->shotButton->move(this->rendererContainer->width() / 2 - (this->shotButton->width()-20) / 2, this->rendererContainer->height()-40);
当我尝试使用 QOpenGLWidget 时它起作用了,但是使用 Qt3DWindow 这个按钮总是不可见的。看起来 Qt3DWindow 在它上面绘制。
【问题讨论】: