forked from qt-creator/qt-creator
QmlDesigner: Do not crash if EditView3D contains errors
EditView3D.qml can contain errors, most likely because of QtQuick3D updates. Change-Id: I85879d9079ba8771a2af4478ba2e4e63a6aa9223 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
@@ -84,6 +84,11 @@ static QObject *createEditView3D(QQmlEngine *engine)
|
|||||||
|
|
||||||
QWindow *window = qobject_cast<QWindow *>(component.create());
|
QWindow *window = qobject_cast<QWindow *>(component.create());
|
||||||
|
|
||||||
|
if (!window) {
|
||||||
|
qWarning() << "Could not create edit view" << component.errors();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
//For macOS we have to use the 4.1 core profile
|
//For macOS we have to use the 4.1 core profile
|
||||||
QSurfaceFormat surfaceFormat = window->requestedFormat();
|
QSurfaceFormat surfaceFormat = window->requestedFormat();
|
||||||
surfaceFormat.setVersion(4, 1);
|
surfaceFormat.setVersion(4, 1);
|
||||||
@@ -193,6 +198,9 @@ void Qt5InformationNodeInstanceServer::setup3DEditView(const QList<ServerNodeIns
|
|||||||
if (node) { // If we found a scene we create the edit view
|
if (node) { // If we found a scene we create the edit view
|
||||||
QObject *view = createEditView3D(engine());
|
QObject *view = createEditView3D(engine());
|
||||||
|
|
||||||
|
if (!view)
|
||||||
|
return;
|
||||||
|
|
||||||
QQmlProperty sceneProperty(view, "scene", context());
|
QQmlProperty sceneProperty(view, "scene", context());
|
||||||
node->setParent(view);
|
node->setParent(view);
|
||||||
sceneProperty.write(objectToVariant(node));
|
sceneProperty.write(objectToVariant(node));
|
||||||
|
Reference in New Issue
Block a user