KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
scxmlimport/main.cpp

This examples shows how to import a KDSME::StateMachine by importing a SCXML document

/*
This file is part of the KDAB State Machine Editor Library.
SPDX-FileCopyrightText: 2015 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Kevin Funk <kevin.funk@kdab.com>
SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor
Licensees holding valid commercial KDAB State Machine Editor Library
licenses may use this file in accordance with the KDAB State Machine Editor
Library License Agreement provided with the Software.
Contact info@kdab.com if any conditions of this licensing are not clear to you.
*/
#include "config-examples.h"
#include <scxmlimporter.h>
#include <state.h>
#include <QApplication>
#include <QDebug>
#include <QFile>
#include <QScopedPointer>
using namespace KDSME;
int main(int argc, char **argv)
{
const QApplication app(argc, argv);
const QString fileName = QStringLiteral(TEST_DATA_DIR "/scxml/microwave.scxml");
QFile file(fileName);
if (!file.exists()) {
qWarning() << "File does not exist:" << file.fileName();
return 1;
}
Q_ASSERT(file.open(QIODevice::ReadOnly));
ScxmlImporter parser(file.readAll());
const QScopedPointer<StateMachine> machine(parser.import());
Q_ASSERT(machine);
view.scene()->setRootState(machine.data());
view.scene()->layout();
view.resize(800, 600);
view.show();
QApplication::exec();
}
StateMachine * import() override
void setRootState(State *rootState)
Widget for displaying a KDSME::StateMachine in a Qt Quick based view.
KDSME::StateMachineScene * scene
int main(int argc, char **argv)
Definition main.cpp:48

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDStateMachineEditor
Create Qt State Machine metacode using a graphical user interface
https://github.com/KDAB/KDStateMachineEditor
Generated on Tue Jul 15 2025 15:21:47 for KDStateMachineEditor API Documentation by doxygen 1.9.8