Thanks Ulf. I think that is exactly what we need.
I tried out the following. but I was having some trouble accessing the
pointer to the dataModel. Am I on the right track?
*SCXML:*
<scxml ... datamodel="cplusplus:LionDataModel:liondatamodel.h" ... >
*liondatamodel.h:*
#include "qscxmlcppdatamodel.h"
class LionDataModel: public QScxmlCppDataModel
{
Q_OBJECT
Q_SCXML_DATAMODEL
};
*C++:*
stateMachine->connectToState("state1", [this](bool active) {
QScxmlDataModel* dataModel = stateMachine->dataModel(); //Returns a
null pointer
QScxmlCppDataModel* cppDataModel =
static_cast<QScxmlCppDataModel*>(dataModel);
QScxmlEvent event = cppDataModel->scxmlEvent();
QVariant data = event.data();
qDebug() << "event.data()" << data;
});
Best,
Jonathan
On Fri, Mar 16, 2018 at 10:38 AM, Ulf Hermann <[email protected]> wrote:
> > In the example above, how would we get access to Event parameter for
> "state1" and "state5"?
>
> You can access the event currently being processed via the data model. The
> EcmaScript data model has a readonly property "_event" and the C++ data
> model has a method scxmlEvent(). The null data model doesn't handle events,
> so without a data model, you can't access them.
>
> br,
> Ulf
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest