summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--configure.json5
-rw-r--r--examples/scxml/calculator-widgets/mainwindow.cpp8
-rw-r--r--examples/scxml/calculator-widgets/mainwindow.ui3
-rw-r--r--examples/scxml/ftpclient/ftpcontrolchannel.cpp9
-rw-r--r--examples/scxml/ftpclient/ftpcontrolchannel.h2
-rw-r--r--examples/scxml/ftpclient/ftpdatachannel.h5
-rw-r--r--examples/scxml/ftpclient/main.cpp14
-rw-r--r--examples/scxml/mediaplayer-common/mainwindow.cpp16
-rw-r--r--examples/scxml/mediaplayer-common/mainwindow.h3
-rw-r--r--examples/scxml/mediaplayer-common/mainwindow.ui3
-rw-r--r--examples/scxml/mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.cpp5
-rw-r--r--examples/scxml/pinball/main.cpp2
-rw-r--r--examples/scxml/pinball/mainwindow.cpp2
-rw-r--r--examples/scxml/pinball/mainwindow.ui3
-rw-r--r--examples/scxml/sudoku/main.cpp2
-rw-r--r--examples/scxml/sudoku/mainwindow.cpp39
-rw-r--r--examples/scxml/trafficlight-common/trafficlight.cpp9
-rw-r--r--examples/scxml/trafficlight-common/trafficlight.h3
-rw-r--r--examples/scxml/trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.cpp3
-rw-r--r--src/imports/scxmlstatemachine/invokedservices_p.h4
-rw-r--r--src/imports/scxmlstatemachine/plugin.cpp9
-rw-r--r--src/imports/scxmlstatemachine/statemachineloader_p.h6
-rw-r--r--src/scxml/configure.json21
-rw-r--r--src/scxml/qscxmlcompiler.cpp1
-rw-r--r--src/scxml/qscxmldatamodel.cpp9
-rw-r--r--src/scxml/qscxmldatamodel.h4
-rw-r--r--src/scxml/qscxmlecmascriptdatamodel.cpp17
-rw-r--r--src/scxml/qscxmlecmascriptdatamodel.h7
-rw-r--r--src/scxml/qscxmlecmascriptplatformproperties_p.h2
-rw-r--r--src/scxml/qscxmlevent_p.h2
-rw-r--r--src/scxml/qscxmlexecutablecontent.cpp2
-rw-r--r--src/scxml/qscxmlglobals.h1
-rw-r--r--src/scxml/scxml.pro18
-rw-r--r--tests/auto/scion/tst_scion.cpp2
-rw-r--r--tools/qscxmlc/data.t20
-rw-r--r--tools/qscxmlc/generator.cpp8
-rw-r--r--tools/qscxmlc/generator.h2
38 files changed, 169 insertions, 104 deletions
diff --git a/.qmake.conf b/.qmake.conf
index b3965ca..312e14e 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -2,4 +2,4 @@ load(qt_build_config)
CONFIG += qt_example_installs
CONFIG += warning_clean
-MODULE_VERSION = 5.11.2
+MODULE_VERSION = 5.12.0
diff --git a/configure.json b/configure.json
new file mode 100644
index 0000000..9f9d32f
--- /dev/null
+++ b/configure.json
@@ -0,0 +1,5 @@
+{
+ "subconfigs": [
+ "src/scxml"
+ ]
+}
diff --git a/examples/scxml/calculator-widgets/mainwindow.cpp b/examples/scxml/calculator-widgets/mainwindow.cpp
index d8c77f7..b742b95 100644
--- a/examples/scxml/calculator-widgets/mainwindow.cpp
+++ b/examples/scxml/calculator-widgets/mainwindow.cpp
@@ -51,8 +51,8 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
-#include <QStringListModel>
#include <QScxmlStateMachine>
+#include <QStringListModel>
QT_USE_NAMESPACE
@@ -115,8 +115,10 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
m_machine->submitEvent("C");
});
- m_machine->connectToEvent(QLatin1String("updateDisplay"), this, [this](const QScxmlEvent &event) {
- const QString display = event.data().toMap().value("display").toString();
+ m_machine->connectToEvent(QLatin1String("updateDisplay"), this,
+ [this](const QScxmlEvent &event) {
+ const QString display = event.data().toMap()
+ .value("display").toString();
ui->display->setText(display);
});
}
diff --git a/examples/scxml/calculator-widgets/mainwindow.ui b/examples/scxml/calculator-widgets/mainwindow.ui
index 8001ff1..2ee3864 100644
--- a/examples/scxml/calculator-widgets/mainwindow.ui
+++ b/examples/scxml/calculator-widgets/mainwindow.ui
@@ -10,9 +10,6 @@
<height>182</height>
</rect>
</property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="display">
diff --git a/examples/scxml/ftpclient/ftpcontrolchannel.cpp b/examples/scxml/ftpclient/ftpcontrolchannel.cpp
index c37b6e5..5f58105 100644
--- a/examples/scxml/ftpclient/ftpcontrolchannel.cpp
+++ b/examples/scxml/ftpclient/ftpcontrolchannel.cpp
@@ -52,8 +52,10 @@
FtpControlChannel::FtpControlChannel(QObject *parent) : QObject(parent)
{
- connect(&m_socket, &QIODevice::readyRead, this, &FtpControlChannel::onReadyRead);
- connect(&m_socket, &QAbstractSocket::disconnected, this, &FtpControlChannel::closed);
+ connect(&m_socket, &QIODevice::readyRead,
+ this, &FtpControlChannel::onReadyRead);
+ connect(&m_socket, &QAbstractSocket::disconnected,
+ this, &FtpControlChannel::closed);
connect(&m_socket, &QAbstractSocket::connected, this, [this]() {
emit opened(m_socket.localAddress(), m_socket.localPort());
});
@@ -64,7 +66,8 @@ void FtpControlChannel::connectToServer(const QString &server)
m_socket.connectToHost(server, 21);
}
-void FtpControlChannel::command(const QByteArray &command, const QByteArray &params)
+void FtpControlChannel::command(const QByteArray &command,
+ const QByteArray &params)
{
QByteArray sendData = command;
if (!params.isEmpty())
diff --git a/examples/scxml/ftpclient/ftpcontrolchannel.h b/examples/scxml/ftpclient/ftpcontrolchannel.h
index 78a2486..092f2a9 100644
--- a/examples/scxml/ftpclient/ftpcontrolchannel.h
+++ b/examples/scxml/ftpclient/ftpcontrolchannel.h
@@ -51,9 +51,9 @@
#ifndef FTPCONTROLCHANNEL_H
#define FTPCONTROLCHANNEL_H
+#include <QHostAddress>
#include <QObject>
#include <QTcpSocket>
-#include <QHostAddress>
class FtpControlChannel : public QObject
{
diff --git a/examples/scxml/ftpclient/ftpdatachannel.h b/examples/scxml/ftpclient/ftpdatachannel.h
index 097e7e7..2418196 100644
--- a/examples/scxml/ftpclient/ftpdatachannel.h
+++ b/examples/scxml/ftpclient/ftpdatachannel.h
@@ -52,9 +52,9 @@
#define FTPDATACHANNEL_H
#include <QObject>
+#include <QScopedPointer>
#include <QTcpServer>
#include <QTcpSocket>
-#include <QScopedPointer>
class FtpDataChannel : public QObject
{
@@ -75,7 +75,8 @@ public:
// Something like "a,b,c,d,xxx,yyy" where
// - a.b.c.d would be the IP address in decimal/dot notation and
// - xxx,yyy are the upper and lower 8 bits of the TCP port in decimal
- // (This will only work if the local address we're listening on is actually meaningful)
+ // (This will only work if the local address we're listening on
+ // is actually meaningful)
QString portspec() const;
signals:
diff --git a/examples/scxml/ftpclient/main.cpp b/examples/scxml/ftpclient/main.cpp
index 8dd0c16..b285077 100644
--- a/examples/scxml/ftpclient/main.cpp
+++ b/examples/scxml/ftpclient/main.cpp
@@ -48,11 +48,12 @@
**
****************************************************************************/
-
-#include "simpleftp.h"
#include "ftpcontrolchannel.h"
#include "ftpdatachannel.h"
+#include "simpleftp.h"
+
#include <QCoreApplication>
+
#include <iostream>
struct Command {
@@ -76,14 +77,16 @@ int main(int argc, char *argv[])
FtpControlChannel controlChannel;
// Print all data retrieved from the server on the console.
- QObject::connect(&dataChannel, &FtpDataChannel::dataReceived, [](const QByteArray &data) {
+ QObject::connect(&dataChannel, &FtpDataChannel::dataReceived,
+ [](const QByteArray &data) {
std::cout << data.constData();
});
// Translate server replies into state machine events.
QObject::connect(&controlChannel, &FtpControlChannel::reply, &ftpClient,
[&ftpClient](int code, const QString &parameters) {
- ftpClient.submitEvent(QString("reply.%1xx").arg(code / 100), parameters);
+ ftpClient.submitEvent(QString("reply.%1xx")
+ .arg(code / 100), parameters);
});
// Translate commands from the state machine into FTP control messages.
@@ -96,7 +99,8 @@ int main(int argc, char *argv[])
// Commands to be sent
QList<Command> commands({
{"cmd.USER", "anonymous"},// login
- {"cmd.PORT", ""}, // announce port for data connection, args added below.
+ {"cmd.PORT", ""}, // announce port for data connection,
+ // args added below.
{"cmd.RETR", file} // retrieve a file
});
diff --git a/examples/scxml/mediaplayer-common/mainwindow.cpp b/examples/scxml/mediaplayer-common/mainwindow.cpp
index b4d3760..cedb072 100644
--- a/examples/scxml/mediaplayer-common/mainwindow.cpp
+++ b/examples/scxml/mediaplayer-common/mainwindow.cpp
@@ -51,8 +51,8 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
-#include <QStringListModel>
#include <QScxmlStateMachine>
+#include <QStringListModel>
QT_USE_NAMESPACE
@@ -64,13 +64,15 @@ MainWindow::MainWindow(QScxmlStateMachine *stateMachine, QWidget *parent) :
auto model = new QStringListModel(QStringList() << QStringLiteral("song 1")
<< QStringLiteral("song 2")
- << QStringLiteral("song 3"), this);
+ << QStringLiteral("song 3"),
+ this);
ui->mediaListView->setModel(model);
connect(ui->mediaListView, &QAbstractItemView::clicked,
- [model, stateMachine](const QModelIndex & index) {
+ [model, stateMachine](const QModelIndex &index) {
QVariantMap data;
- data.insert(QStringLiteral("media"), model->data(index, Qt::EditRole).toString());
+ data.insert(QStringLiteral("media"),
+ model->data(index, Qt::EditRole).toString());
stateMachine->submitEvent("tap", data);
});
@@ -86,13 +88,15 @@ MainWindow::~MainWindow()
void MainWindow::started(const QScxmlEvent &event)
{
const QString media = event.data().toMap().value("media").toString();
- ui->logText->appendPlainText(QStringLiteral("call on slot started with media '%1'").arg(media));
+ ui->logText->appendPlainText(QStringLiteral(
+ "call on slot started with media '%1'").arg(media));
ui->statusLabel->setText(QStringLiteral("Playing %1").arg(media));
}
void MainWindow::stopped(const QScxmlEvent &event)
{
const QString media = event.data().toMap().value("media").toString();
- ui->logText->appendPlainText(QStringLiteral("call on slot stopped with media '%1'").arg(media));
+ ui->logText->appendPlainText(QStringLiteral(
+ "call on slot stopped with media '%1'").arg(media));
ui->statusLabel->setText(QStringLiteral("Stopped"));
}
diff --git a/examples/scxml/mediaplayer-common/mainwindow.h b/examples/scxml/mediaplayer-common/mainwindow.h
index 9f26433..59ae27a 100644
--- a/examples/scxml/mediaplayer-common/mainwindow.h
+++ b/examples/scxml/mediaplayer-common/mainwindow.h
@@ -68,7 +68,8 @@ class MainWindow : public QWidget
Q_OBJECT
public:
- explicit MainWindow(QScxmlStateMachine *stateMachine, QWidget *parent = nullptr);
+ explicit MainWindow(QScxmlStateMachine *stateMachine,
+ QWidget *parent = nullptr);
~MainWindow();
private slots:
diff --git a/examples/scxml/mediaplayer-common/mainwindow.ui b/examples/scxml/mediaplayer-common/mainwindow.ui
index 79679a8..2e9e839 100644
--- a/examples/scxml/mediaplayer-common/mainwindow.ui
+++ b/examples/scxml/mediaplayer-common/mainwindow.ui
@@ -10,9 +10,6 @@
<height>350</height>
</rect>
</property>
- <property name="windowTitle">
- <string>Form</string>
- </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QListView" name="mediaListView"/>
diff --git a/examples/scxml/mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.cpp b/examples/scxml/mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.cpp
index 457e4ee..edc62e7 100644
--- a/examples/scxml/mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.cpp
+++ b/examples/scxml/mediaplayer-widgets-dynamic/mediaplayer-widgets-dynamic.cpp
@@ -50,14 +50,15 @@
#include "../mediaplayer-common/mainwindow.h"
-#include <QScxmlStateMachine>
#include <QApplication>
+#include <QScxmlStateMachine>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
- auto machine = QScxmlStateMachine::fromFile(QStringLiteral(":mediaplayer.scxml"));
+ auto machine = QScxmlStateMachine::fromFile(
+ QStringLiteral(":mediaplayer.scxml"));
MainWindow mainWindow(machine);
machine->setParent(&mainWindow);
diff --git a/examples/scxml/pinball/main.cpp b/examples/scxml/pinball/main.cpp
index 832f004..4bf058f 100644
--- a/examples/scxml/pinball/main.cpp
+++ b/examples/scxml/pinball/main.cpp
@@ -48,8 +48,8 @@
**
****************************************************************************/
-#include "pinball.h"
#include "mainwindow.h"
+#include "pinball.h"
#include <QApplication>
diff --git a/examples/scxml/pinball/mainwindow.cpp b/examples/scxml/pinball/mainwindow.cpp
index 777de8a..e146e4d 100644
--- a/examples/scxml/pinball/mainwindow.cpp
+++ b/examples/scxml/pinball/mainwindow.cpp
@@ -51,8 +51,8 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
-#include <QStringListModel>
#include <QScxmlStateMachine>
+#include <QStringListModel>
QT_USE_NAMESPACE
diff --git a/examples/scxml/pinball/mainwindow.ui b/examples/scxml/pinball/mainwindow.ui
index cc25176..601c23e 100644
--- a/examples/scxml/pinball/mainwindow.ui
+++ b/examples/scxml/pinball/mainwindow.ui
@@ -10,9 +10,6 @@
<height>458</height>
</rect>
</property>
- <property name="windowTitle">
- <string>Pinball</string>
- </property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
diff --git a/examples/scxml/sudoku/main.cpp b/examples/scxml/sudoku/main.cpp
index 0af8d72..c65efa3 100644
--- a/examples/scxml/sudoku/main.cpp
+++ b/examples/scxml/sudoku/main.cpp
@@ -48,8 +48,8 @@
**
****************************************************************************/
-#include "sudoku.h"
#include "mainwindow.h"
+#include "sudoku.h"
#include <QApplication>
diff --git a/examples/scxml/sudoku/mainwindow.cpp b/examples/scxml/sudoku/mainwindow.cpp
index 7f7d99e..8b521ae 100644
--- a/examples/scxml/sudoku/mainwindow.cpp
+++ b/examples/scxml/sudoku/mainwindow.cpp
@@ -50,15 +50,15 @@
#include "mainwindow.h"
-#include <QStringListModel>
-#include <QScxmlStateMachine>
#include <QComboBox>
-#include <QToolButton>
-#include <QLabel>
-#include <QGridLayout>
-#include <QFile>
#include <QDir>
+#include <QFile>
+#include <QGridLayout>
+#include <QLabel>
+#include <QScxmlStateMachine>
+#include <QStringListModel>
#include <QTextStream>
+#include <QToolButton>
static int Size = 9;
@@ -114,7 +114,8 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
for (int i = 0; i < Size; i++) {
for (int j = 0; j < Size; j++) {
QToolButton *button = new QToolButton(this);
- button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ button->setSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Expanding);
layout->addWidget(button, i + i / 3, j + j / 3);
m_buttons[i][j] = button;
connect(button, &QToolButton::clicked, [this, i, j] () {
@@ -139,7 +140,8 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
}
m_startButton = new QToolButton(this);
- m_startButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ m_startButton->setSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Expanding);
m_startButton->setText(tr("Start"));
layout->addWidget(m_startButton, Size + 3, 0, 1, 3);
@@ -156,7 +158,8 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
layout->addWidget(m_label, Size + 3, 4, 1, 3);
m_undoButton = new QToolButton(this);
- m_undoButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ m_undoButton->setSizePolicy(QSizePolicy::Expanding,
+ QSizePolicy::Expanding);
m_undoButton->setText(tr("Undo"));
m_undoButton->setEnabled(false);
layout->addWidget(m_undoButton, Size + 3, 8, 1, 3);
@@ -170,9 +173,12 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
layout->addWidget(m_chooser, Size + 4, 0, 1, 11);
QDir dataDir(QLatin1String(":/data"));
- QFileInfoList sudokuFiles = dataDir.entryInfoList(QStringList() << "*.data");
- foreach (const QFileInfo &sudokuFile, sudokuFiles)
- m_chooser->addItem(sudokuFile.completeBaseName(), sudokuFile.absoluteFilePath());
+ QFileInfoList sudokuFiles = dataDir.entryInfoList(QStringList()
+ << "*.data");
+ for (const QFileInfo &sudokuFile : sudokuFiles) {
+ m_chooser->addItem(sudokuFile.completeBaseName(),
+ sudokuFile.absoluteFilePath());
+ }
connect(m_chooser, QOverload<int>::of(&QComboBox::currentIndexChanged),
[this] (int index) {
@@ -181,7 +187,8 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
m_machine->submitEvent("setup", initValues);
});
- const QVariantMap initValues = readSudoku(m_chooser->itemData(0).toString());
+ const QVariantMap initValues = readSudoku(
+ m_chooser->itemData(0).toString());
m_machine->setInitialValues(initValues);
m_machine->connectToState("playing", [this] (bool playing) {
@@ -206,7 +213,8 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
m_machine->connectToEvent("updateGUI", [this] (const QScxmlEvent &event) {
const QVariant data = event.data();
- const QVariantList currentRows = data.toMap().value("currentState").toList();
+ const QVariantList currentRows = data.toMap().value(
+ "currentState").toList();
for (int i = 0; i < currentRows.count(); i++) {
const QVariantList row = currentRows.at(i).toList();
for (int j = 0; j < row.count(); j++) {
@@ -223,7 +231,8 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
const QVariantList row = initRows.at(i).toList();
for (int j = 0; j < row.count(); j++) {
const int value = row.at(j).toInt();
- const bool enabled = !value && active; // enable only zeroes from initState
+ // enable only zeroes from initState
+ const bool enabled = !value && active;
m_buttons[i][j]->setEnabled(enabled);
}
}
diff --git a/examples/scxml/trafficlight-common/trafficlight.cpp b/examples/scxml/trafficlight-common/trafficlight.cpp
index 5e2c6f9..52be91d 100644
--- a/examples/scxml/trafficlight-common/trafficlight.cpp
+++ b/examples/scxml/trafficlight-common/trafficlight.cpp
@@ -50,7 +50,8 @@
#include "trafficlight.h"
-#include <QtWidgets>
+#include <QPainter>
+#include <QVBoxLayout>
class TrafficLightWidget : public QWidget
{
@@ -116,13 +117,15 @@ TrafficLight::TrafficLight(QScxmlStateMachine *machine, QWidget *parent)
QAbstractButton *button = new ButtonWidget(this);
auto setButtonGeometry = [this, button](){
QSize buttonSize = button->sizeHint();
- button->setGeometry(width() - buttonSize.width() - 20, height() - buttonSize.height() - 20,
+ button->setGeometry(width() - buttonSize.width() - 20,
+ height() - buttonSize.height() - 20,
buttonSize.width(), buttonSize.height());
};
connect(button, &QAbstractButton::toggled, this, setButtonGeometry);
setButtonGeometry();
- connect(button, &QAbstractButton::toggled, this, &TrafficLight::toggleWorking);
+ connect(button, &QAbstractButton::toggled,
+ this, &TrafficLight::toggleWorking);
}
void TrafficLight::toggleWorking(bool pause)
diff --git a/examples/scxml/trafficlight-common/trafficlight.h b/examples/scxml/trafficlight-common/trafficlight.h
index c42e41d..78e2c8d 100644
--- a/examples/scxml/trafficlight-common/trafficlight.h
+++ b/examples/scxml/trafficlight-common/trafficlight.h
@@ -51,10 +51,9 @@
#ifndef TRAFFICLIGHT_H
#define TRAFFICLIGHT_H
+#include <QAbstractButton>
#include <QScxmlStateMachine>
-
#include <QWidget>
-#include <QAbstractButton>
class TrafficLight : public QWidget
{
diff --git a/examples/scxml/trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.cpp b/examples/scxml/trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.cpp
index 7b0489e..10f52dc 100644
--- a/examples/scxml/trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.cpp
+++ b/examples/scxml/trafficlight-widgets-dynamic/trafficlight-widgets-dynamic.cpp
@@ -57,7 +57,8 @@ int main(int argc, char **argv)
{
QApplication app(argc, argv);
- QScxmlStateMachine *machine = QScxmlStateMachine::fromFile(QStringLiteral(":statemachine.scxml"));
+ QScxmlStateMachine *machine = QScxmlStateMachine::fromFile(
+ QStringLiteral(":statemachine.scxml"));
if (!machine->parseErrors().isEmpty()) {
QTextStream errs(stderr, QIODevice::WriteOnly);
const auto errors = machine->parseErrors();
diff --git a/src/imports/scxmlstatemachine/invokedservices_p.h b/src/imports/scxmlstatemachine/invokedservices_p.h
index 72d6f2a..5a6dac7 100644
--- a/src/imports/scxmlstatemachine/invokedservices_p.h
+++ b/src/imports/scxmlstatemachine/invokedservices_p.h
@@ -67,7 +67,7 @@ class QScxmlInvokedServices : public QObject, public QQmlParserStatus
Q_INTERFACES(QQmlParserStatus)
Q_CLASSINFO("DefaultProperty", "qmlChildren")
public:
- QScxmlInvokedServices(QObject *parent = 0);
+ QScxmlInvokedServices(QObject *parent = nullptr);
QVariantMap children();
QScxmlStateMachine *stateMachine() const;
@@ -83,7 +83,7 @@ private:
void classBegin() override;
void componentComplete() override;
- QScxmlStateMachine *m_stateMachine = 0;
+ QScxmlStateMachine *m_stateMachine = nullptr;
QList<QObject *> m_qmlChildren;
};
diff --git a/src/imports/scxmlstatemachine/plugin.cpp b/src/imports/scxmlstatemachine/plugin.cpp
index f1cb413..35d5668 100644
--- a/src/imports/scxmlstatemachine/plugin.cpp
+++ b/src/imports/scxmlstatemachine/plugin.cpp
@@ -46,13 +46,6 @@
#include <qqmlextensionplugin.h>
#include <qqml.h>
-static void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtScxml);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QScxmlStateMachinePlugin : public QQmlExtensionPlugin
@@ -61,7 +54,7 @@ class QScxmlStateMachinePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
- QScxmlStateMachinePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); }
+ QScxmlStateMachinePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { }
void registerTypes(const char *uri)
{
// @uri QtScxml
diff --git a/src/imports/scxmlstatemachine/statemachineloader_p.h b/src/imports/scxmlstatemachine/statemachineloader_p.h
index a4ee3f1..88ed445 100644
--- a/src/imports/scxmlstatemachine/statemachineloader_p.h
+++ b/src/imports/scxmlstatemachine/statemachineloader_p.h
@@ -61,13 +61,13 @@ class QScxmlStateMachineLoader: public QObject
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(QScxmlStateMachine* stateMachine READ stateMachine DESIGNABLE false NOTIFY stateMachineChanged)
+ Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine DESIGNABLE false NOTIFY stateMachineChanged)
Q_PROPERTY(QVariantMap initialValues READ initialValues WRITE setInitialValues NOTIFY initialValuesChanged)
- Q_PROPERTY(QScxmlDataModel* dataModel READ dataModel WRITE setDataModel NOTIFY dataModelChanged)
+ Q_PROPERTY(QScxmlDataModel *dataModel READ dataModel WRITE setDataModel NOTIFY dataModelChanged)
public:
- explicit QScxmlStateMachineLoader(QObject *parent = 0);
+ explicit QScxmlStateMachineLoader(QObject *parent = nullptr);
QScxmlStateMachine *stateMachine() const;
diff --git a/src/scxml/configure.json b/src/scxml/configure.json
new file mode 100644
index 0000000..288373d
--- /dev/null
+++ b/src/scxml/configure.json
@@ -0,0 +1,21 @@
+{
+ "module": "scxml",
+
+ "features": {
+ "scxml-ecmascriptdatamodel": {
+ "label": "ECMAScript data model for QtScxml",
+ "purpose": "Enables the usage of ecmascript data models in SCXML state machines.",
+ "section": "SCXML",
+ "output": [ "publicFeature" ]
+ }
+ },
+
+ "summary": [
+ {
+ "section": "Qt Scxml",
+ "entries": [
+ "scxml-ecmascriptdatamodel"
+ ]
+ }
+ ]
+}
diff --git a/src/scxml/qscxmlcompiler.cpp b/src/scxml/qscxmlcompiler.cpp
index 61ad030..e2e9b4c 100644
--- a/src/scxml/qscxmlcompiler.cpp
+++ b/src/scxml/qscxmlcompiler.cpp
@@ -47,7 +47,6 @@
#include <qstring.h>
#ifndef BUILD_QSCXMLC
-#include "qscxmlecmascriptdatamodel.h"
#include "qscxmlinvokableservice_p.h"
#include "qscxmldatamodel_p.h"
#include "qscxmlstatemachine_p.h"
diff --git a/src/scxml/qscxmldatamodel.cpp b/src/scxml/qscxmldatamodel.cpp
index b67628b..ab0ae7c 100644
--- a/src/scxml/qscxmldatamodel.cpp
+++ b/src/scxml/qscxmldatamodel.cpp
@@ -39,7 +39,9 @@
#include "qscxmldatamodel_p.h"
#include "qscxmlnulldatamodel.h"
+#if QT_CONFIG(scxml_ecmascriptdatamodel)
#include "qscxmlecmascriptdatamodel.h"
+#endif
#include "qscxmlstatemachine_p.h"
QT_BEGIN_NAMESPACE
@@ -53,6 +55,11 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ Creates a new foreach loop body.
+ */
+QScxmlDataModel::ForeachLoopBody::ForeachLoopBody()
+{}
+/*!
Destroys a foreach loop body.
*/
QScxmlDataModel::ForeachLoopBody::~ForeachLoopBody()
@@ -145,7 +152,9 @@ QScxmlDataModel *QScxmlDataModelPrivate::instantiateDataModel(DocumentModel::Scx
dataModel = new QScxmlNullDataModel;
break;
case DocumentModel::Scxml::JSDataModel:
+#if QT_CONFIG(scxml_ecmascriptdatamodel)
dataModel = new QScxmlEcmaScriptDataModel;
+#endif
break;
case DocumentModel::Scxml::CppDataModel:
break;
diff --git a/src/scxml/qscxmldatamodel.h b/src/scxml/qscxmldatamodel.h
index c5e57ad..0c9e666 100644
--- a/src/scxml/qscxmldatamodel.h
+++ b/src/scxml/qscxmldatamodel.h
@@ -60,9 +60,11 @@ class Q_SCXML_EXPORT QScxmlDataModel : public QObject
Q_PROPERTY(QScxmlStateMachine *stateMachine READ stateMachine WRITE setStateMachine NOTIFY stateMachineChanged)
public:
- class ForeachLoopBody
+ class Q_SCXML_EXPORT ForeachLoopBody
{
+ Q_DISABLE_COPY(ForeachLoopBody)
public:
+ ForeachLoopBody();
virtual ~ForeachLoopBody();
virtual void run(bool *ok) = 0;
};
diff --git a/src/scxml/qscxmlecmascriptdatamodel.cpp b/src/scxml/qscxmlecmascriptdatamodel.cpp
index d8548d7..da4fe84 100644
--- a/src/scxml/qscxmlecmascriptdatamodel.cpp
+++ b/src/scxml/qscxmlecmascriptdatamodel.cpp
@@ -144,7 +144,7 @@ public:
dataModel.setProperty(QStringLiteral("_x"), platformVars->jsValue());
dataModel.setProperty(QStringLiteral("In"), engine->evaluate(
- QStringLiteral("function(id){return _x.inState(id);}")));
+ QStringLiteral("(function(id){return _x.inState(id);})")));
}
void assignEvent(const QScxmlEvent &event)
@@ -266,7 +266,7 @@ public:
QStringList initialDataNames;
private: // Uses private API
- static void setReadonlyProperty(QJSValue *object, const QString& name, const QJSValue& value)
+ static void setReadonlyProperty(QJSValue *object, const QString &name, const QJSValue &value)
{
qCDebug(qscxmlLog) << "setting read-only property" << name;
QV4::ExecutionEngine *engine = QJSValuePrivate::engine(object);
@@ -283,13 +283,12 @@ private: // Uses private API
}
QV4::ScopedString s(scope, engine->newString(name));
- uint idx = s->asArrayIndex();
- if (idx < UINT_MAX) {
+ QV4::ScopedPropertyKey key(scope, s->toPropertyKey());
+ if (key->isArrayIndex()) {
Q_UNIMPLEMENTED();
return;
}
- s->makeIdentifier();
QV4::ScopedValue v(scope, QJSValuePrivate::convertedToValue(engine, value));
o->defineReadonlyProperty(s, v);
if (engine->hasException)
@@ -303,7 +302,7 @@ private: // Uses private API
SetPropertyFailedForAnotherReason,
};
- static SetPropertyResult setProperty(QJSValue *object, const QString& name, const QJSValue& value)
+ static SetPropertyResult setProperty(QJSValue *object, const QString &name, const QJSValue &value)
{
QV4::ExecutionEngine *engine = QJSValuePrivate::engine(object);
Q_ASSERT(engine);
@@ -317,13 +316,13 @@ private: // Uses private API
}
QV4::ScopedString s(scope, engine->newString(name));
- uint idx = s->asArrayIndex();
- if (idx < UINT_MAX) {
+ QV4::ScopedPropertyKey key(scope, s->toPropertyKey());
+ if (key->isArrayIndex()) {
Q_UNIMPLEMENTED();
return SetPropertyFailedForAnotherReason;
}
- QV4::PropertyAttributes attrs = o->query(s);
+ QV4::PropertyAttributes attrs = o->getOwnProperty(s->toPropertyKey());
if (attrs.isWritable() || attrs.isEmpty()) {
QV4::ScopedValue v(scope, QJSValuePrivate::convertedToValue(engine, value));
o->insertMember(s, v);
diff --git a/src/scxml/qscxmlecmascriptdatamodel.h b/src/scxml/qscxmlecmascriptdatamodel.h
index 658df6d..16f29d4 100644
--- a/src/scxml/qscxmlecmascriptdatamodel.h
+++ b/src/scxml/qscxmlecmascriptdatamodel.h
@@ -40,9 +40,14 @@
#ifndef QSCXMLECMASCRIPTDATAMODEL_H
#define QSCXMLECMASCRIPTDATAMODEL_H
+#include <QtScxml/qscxmlglobals.h>
#include <QtScxml/qscxmldatamodel.h>
QT_BEGIN_NAMESPACE
+
+// We cannot use QT_REQUIRE_CONFIG here, because the feature name contains a dash.
+#if QT_CONFIG(scxml_ecmascriptdatamodel)
+
class QScxmlEcmaScriptDataModelPrivate;
class Q_SCXML_EXPORT QScxmlEcmaScriptDataModel: public QScxmlDataModel
{
@@ -68,6 +73,8 @@ public:
bool setScxmlProperty(const QString &name, const QVariant &value, const QString &context) override;
};
+#endif // QT_CONFIG(scxml_ecmascriptdatamodel)
+
QT_END_NAMESPACE
#endif // QSCXMLECMASCRIPTDATAMODEL_H
diff --git a/src/scxml/qscxmlecmascriptplatformproperties_p.h b/src/scxml/qscxmlecmascriptplatformproperties_p.h
index b751bda..e7b8a09 100644
--- a/src/scxml/qscxmlecmascriptplatformproperties_p.h
+++ b/src/scxml/qscxmlecmascriptplatformproperties_p.h
@@ -58,6 +58,8 @@
QT_FORWARD_DECLARE_CLASS(QJSEngine)
QT_FORWARD_DECLARE_CLASS(QJSValue)
+QT_REQUIRE_CONFIG(scxml_ecmascriptdatamodel);
+
QT_BEGIN_NAMESPACE
class QScxmlStateMachine;
diff --git a/src/scxml/qscxmlevent_p.h b/src/scxml/qscxmlevent_p.h
index 6d7f1c4..cf4e26a 100644
--- a/src/scxml/qscxmlevent_p.h
+++ b/src/scxml/qscxmlevent_p.h
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
#ifndef BUILD_QSCXMLC
class QScxmlEventBuilder
{
- QScxmlStateMachine* stateMachine;
+ QScxmlStateMachine *stateMachine;
QScxmlExecutableContent::StringId instructionLocation;
QString event;
QScxmlExecutableContent::EvaluatorId eventexpr;
diff --git a/src/scxml/qscxmlexecutablecontent.cpp b/src/scxml/qscxmlexecutablecontent.cpp
index ea5f528..206809c 100644
--- a/src/scxml/qscxmlexecutablecontent.cpp
+++ b/src/scxml/qscxmlexecutablecontent.cpp
@@ -234,7 +234,7 @@ using namespace QScxmlExecutableContent;
#ifndef BUILD_QSCXMLC
-static int parseTime(const QString &t, bool *ok = 0)
+static int parseTime(const QString &t, bool *ok = nullptr)
{
if (t.isEmpty()) {
if (ok)
diff --git a/src/scxml/qscxmlglobals.h b/src/scxml/qscxmlglobals.h
index 8672aa1..da45a2b 100644
--- a/src/scxml/qscxmlglobals.h
+++ b/src/scxml/qscxmlglobals.h
@@ -40,6 +40,7 @@
#ifndef QSCXMLGLOBALS_H
#define QSCXMLGLOBALS_H
#include <QtCore/qglobal.h>
+#include <QtScxml/qtscxml-config.h>
QT_BEGIN_NAMESPACE
diff --git a/src/scxml/scxml.pro b/src/scxml/scxml.pro
index 1f5bc25..c3a6aff 100644
--- a/src/scxml/scxml.pro
+++ b/src/scxml/scxml.pro
@@ -1,5 +1,5 @@
TARGET = QtScxml
-QT = core-private qml-private
+QT = core-private
MODULE_CONFIG += c++11 qscxmlc
load(qt_module)
@@ -17,8 +17,6 @@ HEADERS += \
qscxmlglobals.h \
qscxmlglobals_p.h \
qscxmlnulldatamodel.h \
- qscxmlecmascriptdatamodel.h \
- qscxmlecmascriptplatformproperties_p.h \
qscxmlexecutablecontent.h \
qscxmlexecutablecontent_p.h \
qscxmlevent.h \
@@ -38,8 +36,6 @@ SOURCES += \
qscxmlcompiler.cpp \
qscxmlstatemachine.cpp \
qscxmlnulldatamodel.cpp \
- qscxmlecmascriptdatamodel.cpp \
- qscxmlecmascriptplatformproperties.cpp \
qscxmlexecutablecontent.cpp \
qscxmlevent.cpp \
qscxmldatamodel.cpp \
@@ -49,6 +45,18 @@ SOURCES += \
qscxmltabledata.cpp \
qscxmlstatemachineinfo.cpp
+qtConfig(scxml-ecmascriptdatamodel) {
+ QT += qml-private
+
+ HEADERS += \
+ qscxmlecmascriptdatamodel.h \
+ qscxmlecmascriptplatformproperties_p.h
+
+ SOURCES += \
+ qscxmlecmascriptdatamodel.cpp \
+ qscxmlecmascriptplatformproperties.cpp
+}
+
FEATURES += ../../mkspecs/features/qscxmlc.prf
features.files = $$FEATURES
features.path = $$[QT_HOST_DATA]/mkspecs/features/
diff --git a/tests/auto/scion/tst_scion.cpp b/tests/auto/scion/tst_scion.cpp
index 7b7c008..5473e9d 100644
--- a/tests/auto/scion/tst_scion.cpp
+++ b/tests/auto/scion/tst_scion.cpp
@@ -31,7 +31,7 @@
#include <QJsonDocument>
#include <QtScxml/qscxmlcompiler.h>
-#include <QtScxml/qscxmlecmascriptdatamodel.h>
+#include <QtScxml/qscxmlstatemachine.h>
#include <functional>
diff --git a/tools/qscxmlc/data.t b/tools/qscxmlc/data.t
index a813d01..3926507 100644
--- a/tools/qscxmlc/data.t
+++ b/tools/qscxmlc/data.t
@@ -8,38 +8,38 @@ struct ${classname}::Data: private QScxmlTableData {
${dataModelInitialization}
}
- QString name() const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QString name() const override final
{ return ${name}; }
- QScxmlExecutableContent::ContainerId initialSetup() const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QScxmlExecutableContent::ContainerId initialSetup() const override final
{ return ${initialSetup}; }
- QScxmlExecutableContent::InstructionId *instructions() const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QScxmlExecutableContent::InstructionId *instructions() const override final
{ return theInstructions; }
- QScxmlExecutableContent::StringId *dataNames(int *count) const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QScxmlExecutableContent::StringId *dataNames(int *count) const override final
{ *count = ${dataNameCount}; return dataIds; }
- QScxmlExecutableContent::EvaluatorInfo evaluatorInfo(QScxmlExecutableContent::EvaluatorId evaluatorId) const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QScxmlExecutableContent::EvaluatorInfo evaluatorInfo(QScxmlExecutableContent::EvaluatorId evaluatorId) const override final
{ Q_ASSERT(evaluatorId >= 0); Q_ASSERT(evaluatorId < ${evaluatorCount}); return evaluators[evaluatorId]; }
- QScxmlExecutableContent::AssignmentInfo assignmentInfo(QScxmlExecutableContent::EvaluatorId assignmentId) const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QScxmlExecutableContent::AssignmentInfo assignmentInfo(QScxmlExecutableContent::EvaluatorId assignmentId) const override final
{ Q_ASSERT(assignmentId >= 0); Q_ASSERT(assignmentId < ${assignmentCount}); return assignments[assignmentId]; }
- QScxmlExecutableContent::ForeachInfo foreachInfo(QScxmlExecutableContent::EvaluatorId foreachId) const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QScxmlExecutableContent::ForeachInfo foreachInfo(QScxmlExecutableContent::EvaluatorId foreachId) const override final
{ Q_ASSERT(foreachId >= 0); Q_ASSERT(foreachId < ${foreachCount}); return foreaches[foreachId]; }
- QString string(QScxmlExecutableContent::StringId id) const Q_DECL_OVERRIDE Q_DECL_FINAL
+ QString string(QScxmlExecutableContent::StringId id) const override final
{
Q_ASSERT(id >= QScxmlExecutableContent::NoString); Q_ASSERT(id < ${stringCount});
if (id == QScxmlExecutableContent::NoString) return QString();
return QString({static_cast<QStringData*>(strings.data + id)});
}
- const qint32 *stateMachineTable() const Q_DECL_OVERRIDE Q_DECL_FINAL
+ const qint32 *stateMachineTable() const override final
{ return theStateMachineTable; }
- QScxmlInvokableServiceFactory *serviceFactory(int id) const Q_DECL_OVERRIDE Q_DECL_FINAL;
+ QScxmlInvokableServiceFactory *serviceFactory(int id) const override final;
${classname} &stateMachine;
${dataModelField}
diff --git a/tools/qscxmlc/generator.cpp b/tools/qscxmlc/generator.cpp
index 3de3736..ea3a066 100644
--- a/tools/qscxmlc/generator.cpp
+++ b/tools/qscxmlc/generator.cpp
@@ -617,7 +617,7 @@ void Generator::generateClassInfos()
}
}
-void Generator::registerFunctionStrings(const QList<FunctionDef>& list)
+void Generator::registerFunctionStrings(const QList<FunctionDef> &list)
{
for (int i = 0; i < list.count(); ++i) {
const FunctionDef &f = list.at(i);
@@ -637,7 +637,7 @@ void Generator::registerFunctionStrings(const QList<FunctionDef>& list)
}
}
-void Generator::generateFunctions(const QList<FunctionDef>& list, const char *functype, int type, int &paramsIndex)
+void Generator::generateFunctions(const QList<FunctionDef> &list, const char *functype, int type, int &paramsIndex)
{
if (list.isEmpty())
return;
@@ -683,7 +683,7 @@ void Generator::generateFunctions(const QList<FunctionDef>& list, const char *fu
}
}
-void Generator::generateFunctionRevisions(const QList<FunctionDef>& list, const char *functype)
+void Generator::generateFunctionRevisions(const QList<FunctionDef> &list, const char *functype)
{
if (list.count())
fprintf(out, "\n // %ss: revision\n", functype);
@@ -693,7 +693,7 @@ void Generator::generateFunctionRevisions(const QList<FunctionDef>& list, const
}
}
-void Generator::generateFunctionParameters(const QList<FunctionDef>& list, const char *functype)
+void Generator::generateFunctionParameters(const QList<FunctionDef> &list, const char *functype)
{
if (list.isEmpty())
return;
diff --git a/tools/qscxmlc/generator.h b/tools/qscxmlc/generator.h
index 9109188..e1f10eb 100644
--- a/tools/qscxmlc/generator.h
+++ b/tools/qscxmlc/generator.h
@@ -55,7 +55,7 @@ private:
void generateClassInfos();
void registerFunctionStrings(const QList<FunctionDef> &list);
void generateFunctions(const QList<FunctionDef> &list, const char *functype, int type, int &paramsIndex);
- void generateFunctionRevisions(const QList<FunctionDef>& list, const char *functype);
+ void generateFunctionRevisions(const QList<FunctionDef> &list, const char *functype);
void generateFunctionParameters(const QList<FunctionDef> &list, const char *functype);
void generateTypeInfo(const QByteArray &typeName, bool allowEmptyName = false);
void registerEnumStrings();