Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qundostack_p.h
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
#
ifndef
QUNDOSTACK_P_H
6
#
define
QUNDOSTACK_P_H
7
8
#
include
<
QtGui
/
private
/
qtguiglobal_p
.
h
>
9
#
include
<
private
/
qobject_p
.
h
>
10
#
include
<
QtCore
/
qlist
.
h
>
11
#
include
<
QtCore
/
qstring
.
h
>
12
#
if
QT_CONFIG
(
action
)
13
#
include
<
QtGui
/
qaction
.
h
>
14
#
endif
15
16
#
include
"qundostack.h"
17
18
QT_BEGIN_NAMESPACE
19
class
QUndoCommand;
20
class
QUndoGroup;
21
22
//
23
// W A R N I N G
24
// -------------
25
//
26
// This file is not part of the Qt API. It exists purely as an
27
// implementation detail. This header file may change from version to
28
// version without notice, or even be removed.
29
//
30
// We mean it.
31
//
32
33
class
QUndoCommandPrivate
34
{
35
public
:
36
QUndoCommandPrivate
() :
id
(-1),
obsolete
(
false
) {}
37
QList
<
QUndoCommand
*>
child_list
;
38
QString
text
;
39
QString
actionText
;
40
int
id
;
41
bool
obsolete
;
42
};
43
44
#
if
QT_CONFIG
(
undostack
)
45
46
class
QUndoStackPrivate :
public
QObjectPrivate
47
{
48
Q_DECLARE_PUBLIC(QUndoStack)
49
public
:
50
QUndoStackPrivate() : index(0), clean_index(0), group(
nullptr
), undo_limit(0) {}
51
52
/*!
53
* \internal
54
* \brief Holds the presentation state for an Undo or Redo command.
55
* This structure serves a change-detection purpose.
56
*/
57
struct
ActionState
58
{
59
bool
enabled =
false
;
60
QString text;
61
62
friend
bool
operator==(
const
ActionState &lhs,
const
ActionState &rhs)
noexcept
63
#
ifdef
__cpp_impl_three_way_comparison
64
=
default
;
65
#
else
66
{
return
lhs.enabled == rhs.enabled && lhs.text == rhs.text; }
67
friend
bool
operator!=(
const
ActionState &lhs,
const
ActionState &rhs)
noexcept
68
{
return
!(lhs == rhs); }
69
#
endif
70
// some compiler's reject seed = 0) = delete, overload instead:
71
friend
void
qHash(
const
ActionState &key, size_t seed) =
delete
;
72
friend
void
qHash(
const
ActionState &key) =
delete
;
73
};
74
75
QList<QUndoCommand*> command_list;
76
QList<QUndoCommand*> macro_stack;
77
int
index;
78
int
clean_index;
79
QUndoGroup *group;
80
int
undo_limit;
81
ActionState undoActionState;
82
ActionState redoActionState;
83
84
void
setIndex(
int
idx,
bool
clean);
85
bool
checkUndoLimit();
86
87
#
ifndef
QT_NO_ACTION
88
static
void
setPrefixedText(QAction *action,
const
QString &prefix,
const
QString &defaultText,
const
QString &text);
89
#
endif
90
};
91
92
QT_END_NAMESPACE
93
#
endif
// QT_CONFIG(undostack)
94
#
endif
// QUNDOSTACK_P_H
QUndoCommandPrivate
Definition
qundostack_p.h:34
QUndoCommandPrivate::text
QString text
Definition
qundostack_p.h:38
QUndoCommandPrivate::actionText
QString actionText
Definition
qundostack_p.h:39
QUndoCommandPrivate::id
int id
Definition
qundostack_p.h:40
QUndoCommandPrivate::child_list
QList< QUndoCommand * > child_list
Definition
qundostack_p.h:37
QUndoCommandPrivate::QUndoCommandPrivate
QUndoCommandPrivate()
Definition
qundostack_p.h:36
QUndoCommandPrivate::obsolete
bool obsolete
Definition
qundostack_p.h:41
QUndoCommand
The QUndoCommand class is the base class of all commands stored on a QUndoStack.
Definition
qundostack.h:21
QUndoGroup
The QUndoGroup class is a group of QUndoStack objects.
Definition
qundogroup.h:21
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(undogroup)
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QT_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(liburing)
qtbase
src
gui
util
qundostack_p.h
Generated on
for Qt by
1.18.0