// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qscxmlcppdatamodel_p.h"
#include "qscxmlstatemachine.h"
QT_BEGIN_NAMESPACE
using namespace QScxmlExecutableContent;
/*!
\class QScxmlCppDataModel
\brief The QScxmlCppDataModel class is a C++ data model for a Qt SCXML state machine.
\since 5.7
\inmodule QtScxml
\sa QScxmlStateMachine QScxmlDataModel
The C++ data model for SCXML lets you write C++ code for \e expr attributes and \c
\endcode
This will result in:
\code
bool TheDataModel::evaluateToBool(QScxmlExecutableContent::EvaluatorId id, bool *ok) {
// ....
return [this]()->bool{ return isValidMedia(); }();
// ....
}
QVariant TheDataModel::evaluateToVariant(QScxmlExecutableContent::EvaluatorId id, bool *ok) {
// ....
return [this]()->QVariant{ return media; }();
// ....
}
void TheDataModel::evaluateToVoid(QScxmlExecutableContent::EvaluatorId id, bool *ok) {
// ....
[this]()->void{ media = eventData().value(QStringLiteral("media")).toString(); }();
// ....
}
\endcode
So, you are not limited to call functions. In a \c