Embedded Qt3DWindow not getting closed/removed from widget



  • Hi

    I am developing a Qt application that can load and display 3D (.dae) files. The 3D files load fine. My problem is when I try to load another 3D file on the same Qt3DWindow. Before trying to load the file, I close the viewer and then load the file.

    // Loading 3D
    mainWindow->view = new Qt3DExtras::Qt3DWindow(); // view is an object of type Qt3DExtras::Qt3DWindow
    mainWindow->container = QWidget::createWindowContainer(mainWindow->view);
    
    // Closing the viewer
    mainWindow->view->close();
    mainWindow->mainLayout->removeWidget(mainWindow->container);
    

    But somehow, the viewer isn't being closed or removed. This causes my window to have multiple viewers that stay in the background. If the user resizes the window then those viewers become visible at the borders.

    Any idea, what's wrong?
    I am using Qt 5.7 on Windows.


  • Moderators

    @poortipant Did you try to delete mainWindow->container, or if you need it later to hide it?



  • @jsulm
    Thanks for the response!
    Yes, currently, as a temporary solution, I am hiding the views before creating a new one. But this causes problems when I close the application window. As, the viewer is not being closed, it causes the application to crash.

    I might have found something on this,
    https://bugreports.qt.io/browse/QTBUG-53834
    Will try my code on version 5.7.1 and see what happens.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.