KDStateMachineEditor API Documentation
2.1
Loading...
Searching...
No Matches
src
view
command
modifydefaultstatecommand.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: Volker Krause <volker.krause@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 "
modifydefaultstatecommand_p.h
"
17
18
#include "
state.h
"
19
#include "
elementutil.h
"
20
21
#include "debug.h"
22
23
using namespace
KDSME
;
24
25
ModifyDefaultStateCommand::ModifyDefaultStateCommand
(
HistoryState
*state,
State
*defaultState, QUndoCommand *parent)
26
:
Command
(QString(), parent)
27
, m_state(state)
28
, m_defaultState(defaultState)
29
{
30
Q_ASSERT(state);
31
setText(tr(
"Changing default state of %1"
).arg(state->
label
()));
32
}
33
34
ModifyDefaultStateCommand::~ModifyDefaultStateCommand
() =
default
;
// NOLINT(clang-analyzer-cplusplus.NewDelete)
35
36
int
ModifyDefaultStateCommand::id
()
const
37
{
38
return
Command::ModifyDefaultState
;
39
}
40
41
void
ModifyDefaultStateCommand::undo
()
42
{
43
if
(!m_state)
44
return
;
45
46
m_state->setDefaultState(m_oldDefaultState);
47
}
48
49
void
ModifyDefaultStateCommand::redo
()
50
{
51
if
(!m_state)
52
return
;
53
54
m_oldDefaultState = m_state->defaultState();
55
m_state->setDefaultState(m_defaultState);
56
}
KDSME::Command
Definition
command_p.h:27
KDSME::Command::ModifyDefaultState
@ ModifyDefaultState
Definition
command_p.h:39
KDSME::Element::label
QString label
Definition
element.h:40
KDSME::HistoryState
Definition
state.h:103
KDSME::ModifyDefaultStateCommand::ModifyDefaultStateCommand
ModifyDefaultStateCommand(HistoryState *state, State *defaultState, QUndoCommand *parent=nullptr)
Definition
modifydefaultstatecommand.cpp:25
KDSME::ModifyDefaultStateCommand::redo
void redo() override
Definition
modifydefaultstatecommand.cpp:49
KDSME::ModifyDefaultStateCommand::~ModifyDefaultStateCommand
~ModifyDefaultStateCommand()
KDSME::ModifyDefaultStateCommand::id
int id() const override
Definition
modifydefaultstatecommand.cpp:36
KDSME::ModifyDefaultStateCommand::undo
void undo() override
Definition
modifydefaultstatecommand.cpp:41
KDSME::State
Definition
state.h:29
elementutil.h
modifydefaultstatecommand_p.h
KDSME
Definition
mainwindow.h:21
state.h
© 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