diff options
author | Liang Qi <liang.qi@qt.io> | 2017-11-20 13:17:55 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-11-20 14:43:13 +0100 |
commit | ac1bc572a22ed3de61076e2b8f27dea52171ddc8 (patch) | |
tree | 8bca4d937c192117565b6e04c16e6aaab745c57e /src | |
parent | c5c6aba3b07a44726da96cd2acaed05e67fe3ff8 (diff) | |
parent | 4f94bae73ccabfc714d248c6371f1883aacc1aa8 (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
src/scxml/qscxmlcompiler.cpp
Change-Id: I4abda984e523cdf2a0810ed7dc1773e055746e18
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineloader.cpp | 13 | ||||
-rw-r--r-- | src/scxml/qscxmlcompiler.cpp | 9 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/imports/scxmlstatemachine/statemachineloader.cpp b/src/imports/scxmlstatemachine/statemachineloader.cpp index 682bbed..d691479 100644 --- a/src/imports/scxmlstatemachine/statemachineloader.cpp +++ b/src/imports/scxmlstatemachine/statemachineloader.cpp @@ -163,7 +163,18 @@ bool QScxmlStateMachineLoader::parse(const QUrl &source) return false; } - m_stateMachine = QScxmlStateMachine::fromData(&buf, source.toString()); + QString fileName; + if (source.isLocalFile()) { + fileName = source.toLocalFile(); + } else if (source.scheme() == QStringLiteral("qrc")) { + fileName = ":" + source.path(); + } else { + qmlWarning(this) << QStringLiteral("%1 is neither a local nor a resource URL.") + .arg(source.url()) + << QStringLiteral("Invoking services by relative path will not work."); + } + + m_stateMachine = QScxmlStateMachine::fromData(&buf, fileName); m_stateMachine->setParent(this); m_implicitDataModel = m_stateMachine->dataModel(); diff --git a/src/scxml/qscxmlcompiler.cpp b/src/scxml/qscxmlcompiler.cpp index a5946a1..cc89ad1 100644 --- a/src/scxml/qscxmlcompiler.cpp +++ b/src/scxml/qscxmlcompiler.cpp @@ -683,7 +683,7 @@ QScxmlScxmlService *invokeDynamicScxmlService(const QString &sourceUrl, if (!compiler.errors().isEmpty()) { const auto errors = compiler.errors(); for (const QScxmlError &error : errors) - qWarning() << error.toString(); + qWarning().noquote() << error.toString(); return nullptr; } @@ -692,7 +692,7 @@ QScxmlScxmlService *invokeDynamicScxmlService(const QString &sourceUrl, Q_ASSERT(!compiler.errors().isEmpty()); const auto errors = compiler.errors(); for (const QScxmlError &error : errors) - qWarning() << error.toString(); + qWarning().noquote() << error.toString(); return nullptr; } @@ -845,6 +845,11 @@ void QScxmlCompilerPrivate::instantiateDataModel(QScxmlStateMachine *stateMachin #ifdef BUILD_QSCXMLC Q_UNUSED(stateMachine) #else + if (!m_errors.isEmpty()) { + qWarning() << "SCXML document has errors"; + return; + } + auto doc = scxmlDocument(); auto root = doc ? doc->root : nullptr; if (root == nullptr) { |