KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
commandcontroller.cpp
Go to the documentation of this file.
1/*
2 This file is part of the KDAB State Machine Editor Library.
3
4 SPDX-FileCopyrightText: 2014 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: Kevin Funk <kevin.funk@kdab.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor
8
9 Licensees holding valid commercial KDAB State Machine Editor Library
10 licenses may use this file in accordance with the KDAB State Machine Editor
11 Library License Agreement provided with the Software.
12
13 Contact info@kdab.com if any conditions of this licensing are not clear to you.
14*/
15
16#include "commandcontroller.h"
17
18#include "command_p.h"
19#include "element.h"
20
21#include <QQmlEngine>
22
23using namespace KDSME;
24
25struct CommandController::Private
26{
27 Private();
28
29 QUndoStack *m_undoStack;
30};
31
32CommandController::Private::Private()
33 : m_undoStack(nullptr)
34{
35}
36
38 : AbstractController(parent)
39 , d(new Private)
40{
41 d->m_undoStack = undoStack;
42 Q_ASSERT(d->m_undoStack);
43
44 qRegisterMetaType<Command *>();
45}
46
50
52{
53 return d->m_undoStack;
54}
55
57{
58 Q_ASSERT(command);
59 QQmlEngine::setObjectOwnership(command, QQmlEngine::CppOwnership); // transfer ownership
60 d->m_undoStack->push(command);
61}
62
64{
65 d->m_undoStack->clear();
66}
67
68#include "moc_commandcontroller.cpp"
Q_INVOKABLE void push(KDSME::Command *command)
CommandController(QUndoStack *undoStack, StateMachineView *parent)
Widget for displaying a KDSME::StateMachine in a Qt Quick based view.

© 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