I am using QQmlVTKPlugin
, which allows me to directly access to VTKRenderWindow
and VTKRenderItem
with QML. To setup this I need to give to my QQMLApplicationEngine
a QQuickWindow
and a QQuickItem
. If I just do this initialization from the main.cpp everything works correctly but for some reason I need to do that by calling a class constructor inside my QML file with a singleton. I call the following constructor from the QML but when I do window->show()
my application crashes
SceneManage::SceneManage(QObject *topLevel)
{
window = qobject_cast<QQuickWindow *>(topLevel); // QQuickWindow window
window->show();
QQuickItem *item = topLevel->findChild<QQuickItem *>("3DViewer");
...
Does someone have a way to do what I want ?
CodePudding user response:
Solution : Don't decide to show the window from c but only set visible parameter in QML.