QQuickWidget as viewport for QMdiArea
-
I would like to use a QQuickWidget to show a 3D scene (QtQuick3D) as the background of a QMdiArea.
I tried to create a QQuickWidget and set it as the viewport of the QMdiArea but it didn't work at all. I got few error message such as Unrecognized OpenGL Version, and QQuickWidget: Failed to make context current.
I have other part of my software where I used QQuickWidget to show some QML items and they are working fine.
// in the constructor of my QMdiArea subclass. auto p= new QQuickWidget(); auto engine= p->engine(); connect(engine, &QQmlEngine::warnings, this, [](const QList<QQmlError>& warnings) { for(const auto& warn : warnings) {// never called qDebug() << "engine error:" << warn.description() << warn.messageType(); } }); connect(p, &QQuickWidget::statusChanged, this, [p](QQuickWidget::Status st) { if(st == QQuickWidget::Error) {// never called auto errors= p->errors(); for(const auto& warn : errors) { qDebug() << "quickwidget error:" << warn.description() << warn.messageType(); } } }); p->setSource(QUrl("qrc:/qml/views/DiceField.qml")); setViewport(p); // tried with or without hoping to have a second window or anything. p->show(); // tried with or without
Any clue ?
Regards.