forked from qt-creator/qt-creator
QmlDesigner.QmlPuppet: Show import error messages on root item
* If an import fails we show this as an error on the root item. * If all imports fail (including the QtQuick import) we also show an error message, but try to recover using QtQuick 2.0. Change-Id: Ibfece2acdb9f2a6ba26dfd9b31607507fec82dd1 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
7c192f6490
commit
e8c8968ab6
@@ -420,11 +420,8 @@ void NodeInstanceServer::setupImports(const QVector<AddImportContainer> &contain
|
||||
workingImportStatementList.prepend(firstWorkingImportStatement);
|
||||
}
|
||||
|
||||
QVector<qint32> instanceIds;
|
||||
foreach (const IdContainer &idContainer, idContainerVector)
|
||||
instanceIds.append(idContainer.instanceId());
|
||||
if (!errorMessage.isEmpty())
|
||||
sendDebugOutput(DebugOutputCommand::WarningType, errorMessage, instanceIds);
|
||||
sendDebugOutput(DebugOutputCommand::WarningType, errorMessage);
|
||||
setupOnlyWorkingImports(workingImportStatementList);
|
||||
}
|
||||
|
||||
@@ -438,6 +435,15 @@ void NodeInstanceServer::setupOnlyWorkingImports(const QStringList &workingImpor
|
||||
|
||||
m_importComponent->setData(componentCode.append("\nItem {}\n"), fileUrl());
|
||||
m_importComponentObject = m_importComponent->create();
|
||||
|
||||
if (!m_importComponentObject) {
|
||||
delete m_importComponent;
|
||||
m_importComponent = new QQmlComponent(engine(), quickView());
|
||||
m_importComponent->setData("import QtQuick 2.0\n\nItem {}\n", fileUrl());
|
||||
sendDebugOutput(DebugOutputCommand::WarningType, tr("No working QtQuick import"));
|
||||
m_importComponentObject = m_importComponent->create();
|
||||
}
|
||||
|
||||
Q_ASSERT(m_importComponent && m_importComponentObject);
|
||||
Q_ASSERT_X(m_importComponent->errors().isEmpty(), __FUNCTION__, m_importComponent->errorString().toLatin1());
|
||||
}
|
||||
|
@@ -128,7 +128,7 @@ public:
|
||||
virtual QQmlView *declarativeView() const = 0;
|
||||
virtual QQuickView *quickView() const = 0;
|
||||
|
||||
void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId);
|
||||
void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId = 0);
|
||||
void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, const QVector<qint32> &instanceIds);
|
||||
|
||||
void removeInstanceRelationsipForDeletedObject(QObject *object);
|
||||
|
Reference in New Issue
Block a user