summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/reference/modules/qt-scxml-module.qdoc10
-rw-r--r--src/lib/qtprofilesetup/templates/scxml.qbs9
-rw-r--r--tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs1
-rw-r--r--tests/auto/blackbox/tst_blackboxqt.cpp5
4 files changed, 25 insertions, 0 deletions
diff --git a/doc/reference/modules/qt-scxml-module.qdoc b/doc/reference/modules/qt-scxml-module.qdoc
index 2be5b6be7..34f0461d6 100644
--- a/doc/reference/modules/qt-scxml-module.qdoc
+++ b/doc/reference/modules/qt-scxml-module.qdoc
@@ -65,6 +65,16 @@
*/
/*!
+ \qmlproperty string Qt.scxml::generateStateMethods
+
+ If this property is \c true, the Qt SCXML compiler will generate read and notify methods
+ for states.
+
+ \defaultvalue \c false
+ \since 1.11
+*/
+
+/*!
\qmlproperty string Qt.scxml::namespace
The C++ namespace in which to put the generated class.
diff --git a/src/lib/qtprofilesetup/templates/scxml.qbs b/src/lib/qtprofilesetup/templates/scxml.qbs
index 98c3bd30f..f40593637 100644
--- a/src/lib/qtprofilesetup/templates/scxml.qbs
+++ b/src/lib/qtprofilesetup/templates/scxml.qbs
@@ -1,5 +1,6 @@
import qbs 1.0
import qbs.FileInfo
+import qbs.Utilities
import "../QtModule.qbs" as QtModule
QtModule {
@@ -8,6 +9,8 @@ QtModule {
property string qscxmlcName: "qscxmlc"
property string className
property string namespace
+ property bool generateStateMethods
+ property stringList additionalCompilerFlags
Rule {
inputs: ["qt.scxml.compilable"]
@@ -37,6 +40,12 @@ QtModule {
var namespace = input.moduleProperty("Qt.scxml", "namespace");
if (namespace)
args.push("--namespace", namespace);
+ if (input.Qt.scxml.generateStateMethods
+ && Utilities.versionCompare(product.Qt.scxml.version, "5.9") >= 0) {
+ args.push("--statemethods");
+ }
+ if (input.Qt.scxml.additionalCompilerFlags)
+ args = args.concat(input.Qt.scxml.additionalCompilerFlags);
args.push(input.filePath);
var cmd = new Command(compilerPath, args);
cmd.description = "compiling " + input.fileName;
diff --git a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
index 6cbeb9b2f..e010e76e6 100644
--- a/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
+++ b/tests/auto/blackbox/testdata-qt/qtscxml/qtscxml.qbs
@@ -14,6 +14,7 @@ Project {
Qt.scxml.className: "QbsStateMachine"
Qt.scxml.namespace: "QbsTest"
+ Qt.scxml.generateStateMethods: true
files: ["main.cpp"]
Group {
diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp
index f2c263cfa..26d1dbd58 100644
--- a/tests/auto/blackbox/tst_blackboxqt.cpp
+++ b/tests/auto/blackbox/tst_blackboxqt.cpp
@@ -280,6 +280,11 @@ void TestBlackboxQt::qtScxml()
QSKIP("QtScxml module not present");
QVERIFY2(m_qbsStdout.contains("state machine name: qbs_test_machine"),
m_qbsStdout.constData());
+ QCOMPARE(runQbs(QbsRunParameters("resolve",
+ QStringList("modules.Qt.scxml.additionalCompilerFlags:--blubb"))), 0);
+ QbsRunParameters params;
+ params.expectFailure = true;
+ QVERIFY2(runQbs(params) != 0, m_qbsStdout.constData());
}
void TestBlackboxQt::removeMocHeaderFromFileList()