Hello everyone,
I'm using the QScxmlStateMachine and wanted to use the QScxmlCppDataModel.
I copied the "mediaplayer-qml-cppdatamodel" example and executed it without any problem.
Since I'm not using QML, i replaced the main function with the following:
int main(int argc, char *argv[])
{
QScxmlStateMachine* machine = new MediaPlayerStateMachine() ;
machine->start();
return a.exec();
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QScxmlStateMachine* machine = new MediaPlayerStateMachine() ;
machine->start();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Unfortunately, I get a segmentation fault that I remove when I comment the line (in my .scxml) datamodel="cplusplus:TheDataModel:thedatamodel.h".
I also tried to simply add the QScxmlStateMachine instantiation and starting inside the original main function but it still fails.
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<TheDataModel>("MediaPlayerDataModel", 1, 0, "MediaPlayerDataModel");
qmlRegisterType<MediaPlayerStateMachine>("MediaPlayerStateMachine", 1, 0, "MediaPlayerStateMachine");
QQmlApplicationEngine engine;
engine.
load(QUrl(QStringLiteral
("qrc:///mediaplayer-qml-cppdatamodel.qml")));
QScxmlStateMachine* machine = new MediaPlayerStateMachine() ;
machine->start();
return app.exec();
}
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<TheDataModel>("MediaPlayerDataModel", 1, 0, "MediaPlayerDataModel");
qmlRegisterType<MediaPlayerStateMachine>("MediaPlayerStateMachine", 1, 0, "MediaPlayerStateMachine");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///mediaplayer-qml-cppdatamodel.qml")));
QScxmlStateMachine* machine = new MediaPlayerStateMachine() ;
machine->start();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Launching in debug gives only the line where the error occurs which is return app.exec();
Does it ring a bell to anyone?
Thanks.
Qt5.7.1 on linux 64
Bookmarks