forked from qt-creator/qt-creator
QmlPuppet: Fall back to primitive creation if component creation fails
This ensures components defined in .qml files get loaded properly. Change-Id: I070132ab5ad58b2531f27f623f218e0ee3565c5b Fixes: QDS-2697 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
4473769bc4
commit
893d5901a6
@@ -230,11 +230,14 @@ ServerNodeInstance ServerNodeInstance::create(NodeInstanceServer *nodeInstanceSe
|
|||||||
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId());
|
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, QLatin1String("Custom parser object could not be created."), instanceContainer.instanceId());
|
||||||
} else if (!instanceContainer.componentPath().isEmpty()) {
|
} else if (!instanceContainer.componentPath().isEmpty()) {
|
||||||
object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context());
|
object = Internal::ObjectNodeInstance::createComponent(instanceContainer.componentPath(), nodeInstanceServer->context());
|
||||||
|
if (object == nullptr) {
|
||||||
|
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
|
||||||
if (object == nullptr) {
|
if (object == nullptr) {
|
||||||
const QString errors = getErrorString(nodeInstanceServer->engine(), instanceContainer.componentPath());
|
const QString errors = getErrorString(nodeInstanceServer->engine(), instanceContainer.componentPath());
|
||||||
const QString message = QString("Component with path %1 could not be created.\n\n").arg(instanceContainer.componentPath());
|
const QString message = QString("Component with path %1 could not be created.\n\n").arg(instanceContainer.componentPath());
|
||||||
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, message + errors, instanceContainer.instanceId());
|
nodeInstanceServer->sendDebugOutput(DebugOutputCommand::ErrorType, message + errors, instanceContainer.instanceId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
|
object = Internal::ObjectNodeInstance::createPrimitive(QString::fromUtf8(instanceContainer.type()), instanceContainer.majorNumber(), instanceContainer.minorNumber(), nodeInstanceServer->context());
|
||||||
if (object == nullptr)
|
if (object == nullptr)
|
||||||
|
Reference in New Issue
Block a user