diff options
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) { |