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 | |
parent | c5c6aba3b07a44726da96cd2acaed05e67fe3ff8 (diff) | |
parent | 4f94bae73ccabfc714d248c6371f1883aacc1aa8 (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
src/scxml/qscxmlcompiler.cpp
Change-Id: I4abda984e523cdf2a0810ed7dc1773e055746e18
-rw-r--r-- | dist/changes-5.9.2 | 22 | ||||
-rw-r--r-- | examples/scxml/calculator-qml/calculator-qml.qml | 13 | ||||
-rw-r--r-- | examples/scxml/mediaplayer-common/Mediaplayer.qml | 18 | ||||
-rw-r--r-- | src/imports/scxmlstatemachine/statemachineloader.cpp | 13 | ||||
-rw-r--r-- | src/scxml/qscxmlcompiler.cpp | 9 | ||||
-rw-r--r-- | tests/auto/parser/tst_parser.cpp | 3 |
6 files changed, 62 insertions, 16 deletions
diff --git a/dist/changes-5.9.2 b/dist/changes-5.9.2 new file mode 100644 index 0000000..a4cffb5 --- /dev/null +++ b/dist/changes-5.9.2 @@ -0,0 +1,22 @@ +Qt 5.9.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.9.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.9.2 Changes * +**************************************************************************** diff --git a/examples/scxml/calculator-qml/calculator-qml.qml b/examples/scxml/calculator-qml/calculator-qml.qml index 386549e..c7d8236 100644 --- a/examples/scxml/calculator-qml/calculator-qml.qml +++ b/examples/scxml/calculator-qml/calculator-qml.qml @@ -79,8 +79,8 @@ Window { color: "#46a2da" Text { id: resultText - anchors.leftMargin: operations.implicitMargin - anchors.rightMargin: operations.implicitMargin + anchors.leftMargin: buttons.implicitMargin + anchors.rightMargin: buttons.implicitMargin anchors.fill: parent horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter @@ -93,7 +93,7 @@ Window { } Item { - id: operations + id: buttons anchors.top: resultArea.bottom anchors.left: parent.left anchors.right: parent.right @@ -102,12 +102,13 @@ Window { var ret = 0; for (var i = 0; i < visibleChildren.length; ++i) { var child = visibleChildren[i]; - ret += (child.implicitMargin || 0) / visibleChildren.length; + ret += (child.implicitMargin || 0); } - return ret; + return ret / visibleChildren.length; } Repeater { + id: operations model: ["÷", "×", "+", "-"] Button { y: 0 @@ -130,6 +131,7 @@ Window { } Repeater { + id: digits model: ["7", "8", "9", "4", "5", "6", "1", "2", "3", "0", ".", "C"] Button { x: (index % 3) * width @@ -150,6 +152,7 @@ Window { } Button { + id: resultButton x: 3 * width y: parent.height / 5 textHeight: y - 2 diff --git a/examples/scxml/mediaplayer-common/Mediaplayer.qml b/examples/scxml/mediaplayer-common/Mediaplayer.qml index fdeb9d2..42a948a 100644 --- a/examples/scxml/mediaplayer-common/Mediaplayer.qml +++ b/examples/scxml/mediaplayer-common/Mediaplayer.qml @@ -119,22 +119,24 @@ Window { stateMachine: root.stateMachine events: ["playbackStarted", "playbackStopped"] onOccurred: { - var media = event.data.media + var media = event.data.media; if (event.name === "playbackStarted") { - theText.text = "Playing '" + media + "'" + theText.text = "Playing '" + media + "'"; theLog.text = theLog.text + "\nplaybackStarted with data: " - + JSON.stringify(event.data) + + JSON.stringify(event.data); } else if (event.name === "playbackStopped") { - theText.text = "Stopped '" + media + "'" + theText.text = "Stopped '" + media + "'"; theLog.text = theLog.text + "\nplaybackStopped with data: " - + JSON.stringify(event.data) + + JSON.stringify(event.data); } } } + // Submit tap event to state machine. + // "tap" toggles playing state of the current media. function tap(idx) { - var media = theModel.get(idx).media - var data = { "media": media } - stateMachine.submitEvent("tap", data) + var media = theModel.get(idx).media; + var data = { "media": media }; + stateMachine.submitEvent("tap", data); } } 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) { diff --git a/tests/auto/parser/tst_parser.cpp b/tests/auto/parser/tst_parser.cpp index 13eed5a..22b9059 100644 --- a/tests/auto/parser/tst_parser.cpp +++ b/tests/auto/parser/tst_parser.cpp @@ -67,6 +67,9 @@ void tst_Parser::error() const QStringList expectedErrors = QString::fromUtf8(errorFile.readAll()).split('\n', QString::SkipEmptyParts); + if (!expectedErrors.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, "SCXML document has errors"); + QScopedPointer<QScxmlStateMachine> stateMachine(QScxmlStateMachine::fromFile(scxmlFileName)); QVERIFY(!stateMachine.isNull()); |