Qt3D - [c++] Q: 3D Window is not showing on Windows 10 Build
-
Hi!
I am compiling my application on windows using qt creator with QT 5.15.1.
When running, i don't get any errors or warnings. The Application is shown.
Except of - 3D content in the Qt3DWindow (Qt3DExtras::Qt3DWindow).On linux, it is working well.
Do i miss anything which needs to be considered when building / running Qt3D on windows?Any help is highly appreciated!
best regards, kevin
-
This is the code, which displays the window:
view = (Qt3DExtras::Qt3DWindow *)scene; widget = QWidget::createWindowContainer(scene); if (camera == nullptr) { camera = view->camera(); camera->lens()->setPerspectiveProjection(45.0f, 45.0f, 1.0f, 1000.0f); camera->setPosition(QVector3D(0,-50,50)); camera->setViewCenter(QVector3D(0,0,0)); } layout = new QHBoxLayout(widget); layout->setContentsMargins(0,0,0,0); layout->setMargin(8); layout->addWidget(container); widget->setVisible(true); widget->showMinimized(); widget->close(); view->setRootEntity(scene->entity); view->show(); setLayout(layout);
btw, im compiling with VS2019 Toolset and 32 bit.
-
I found out what was the problem:
The Window, which hosts the layout in which the 3D Widget is set, contains the following statement in the constructor:
setWindowState(windowState() | Qt::WindowMaximized);
or..
setWindowState(Qt::WindowMaximized);
I removed this statement and the 3D Window now shows the content.
This is not happening in the Linux build!
Now, both builds work correctly.
Issue is solved.