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.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_H
6
#
define
QUNDOSTACK_H
7
8
#
include
<
QtGui
/
qtguiglobal
.
h
>
9
#
include
<
QtCore
/
qobject
.
h
>
10
#
include
<
QtCore
/
qstring
.
h
>
11
12
QT_REQUIRE_CONFIG
(
undocommand
);
13
14
QT_BEGIN_NAMESPACE
15
16
class
QAction;
17
class
QUndoCommandPrivate
;
18
class
QUndoStackPrivate;
19
20
class
Q_GUI_EXPORT
QUndoCommand
21
{
22
QUndoCommandPrivate *d;
23
24
public
:
25
explicit
QUndoCommand(QUndoCommand *parent =
nullptr
);
26
explicit
QUndoCommand(
const
QString &text, QUndoCommand *parent =
nullptr
);
27
virtual
~QUndoCommand();
28
29
virtual
void
undo();
30
virtual
void
redo();
31
32
QString text()
const
;
33
QString actionText()
const
;
34
void
setText(
const
QString &text);
35
36
bool
isObsolete()
const
;
37
void
setObsolete(
bool
obsolete);
38
39
virtual
int
id()
const
;
40
virtual
bool
mergeWith(
const
QUndoCommand *other);
41
42
int
childCount()
const
;
43
const
QUndoCommand *child(
int
index)
const
;
44
45
private
:
46
Q_DISABLE_COPY(QUndoCommand)
47
friend
class
QUndoStack;
48
};
49
50
#
if
QT_CONFIG
(
undostack
)
51
52
class
Q_GUI_EXPORT QUndoStack :
public
QObject
53
{
54
Q_OBJECT
55
Q_DECLARE_PRIVATE(QUndoStack)
56
Q_PROPERTY(
bool
active READ isActive WRITE setActive)
57
Q_PROPERTY(
int
undoLimit READ undoLimit WRITE setUndoLimit)
58
Q_PROPERTY(
bool
canUndo READ canUndo NOTIFY canUndoChanged)
59
Q_PROPERTY(
bool
canRedo READ canRedo NOTIFY canRedoChanged)
60
Q_PROPERTY(QString undoText READ undoText NOTIFY undoTextChanged)
61
Q_PROPERTY(QString redoText READ redoText NOTIFY redoTextChanged)
62
Q_PROPERTY(
bool
clean READ isClean NOTIFY cleanChanged)
63
64
public
:
65
explicit
QUndoStack(QObject *parent =
nullptr
);
66
~QUndoStack();
67
void
clear();
68
69
void
push(QUndoCommand *cmd);
70
71
bool
canUndo()
const
;
72
bool
canRedo()
const
;
73
QString undoText()
const
;
74
QString redoText()
const
;
75
76
int
count()
const
;
77
int
index()
const
;
78
QString text(
int
idx)
const
;
79
80
#
ifndef
QT_NO_ACTION
81
QAction *createUndoAction(QObject *parent,
const
QString &prefix = QString())
const
;
82
QAction *createRedoAction(QObject *parent,
const
QString &prefix = QString())
const
;
83
#
endif
// QT_NO_ACTION
84
85
bool
isActive()
const
;
86
bool
isClean()
const
;
87
int
cleanIndex()
const
;
88
89
void
beginMacro(
const
QString &text);
90
void
endMacro();
91
92
void
setUndoLimit(
int
limit);
93
int
undoLimit()
const
;
94
95
const
QUndoCommand *command(
int
index)
const
;
96
97
public
Q_SLOTS:
98
void
setClean();
99
void
resetClean();
100
void
setIndex(
int
idx);
101
void
undo();
102
void
redo();
103
void
setActive(
bool
active =
true
);
104
105
Q_SIGNALS:
106
void
indexChanged(
int
idx);
107
void
cleanChanged(
bool
clean);
108
void
canUndoChanged(
bool
canUndo);
109
void
canRedoChanged(
bool
canRedo);
110
void
undoTextChanged(
const
QString &undoText);
111
void
redoTextChanged(
const
QString &redoText);
112
113
private
:
114
Q_DISABLE_COPY(QUndoStack)
115
friend
class
QUndoGroup;
116
};
117
118
#
endif
// QT_CONFIG(undostack)
119
120
QT_END_NAMESPACE
121
122
#
endif
// QUNDOSTACK_H
QUndoCommandPrivate
Definition
qundostack_p.h:34
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_REQUIRE_CONFIG
QT_REQUIRE_CONFIG(liburing)
qtbase
src
gui
util
qundostack.h
Generated on
for Qt by
1.18.0