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
4#ifndef QUNDOSTACK_P_H
5#define QUNDOSTACK_P_H
6
7#include <QtGui/private/qtguiglobal_p.h>
8#include <private/qobject_p.h>
9#include <QtCore/qlist.h>
10#include <QtCore/qstring.h>
11#if QT_CONFIG(action)
12# include <QtGui/qaction.h>
13#endif
14
15#include "qundostack.h"
16
17QT_BEGIN_NAMESPACE
18class QUndoCommand;
19class QUndoGroup;
20
21//
22// W A R N I N G
23// -------------
24//
25// This file is not part of the Qt API. It exists purely as an
26// implementation detail. This header file may change from version to
27// version without notice, or even be removed.
28//
29// We mean it.
30//
31
32class QUndoCommandPrivate
33{
34public:
35 QUndoCommandPrivate() : id(-1), obsolete(false) {}
36 QList<QUndoCommand*> child_list;
37 QString text;
38 QString actionText;
39 int id;
40 bool obsolete;
41};
42
43#if QT_CONFIG(undostack)
44
45class QUndoStackPrivate : public QObjectPrivate
46{
47 Q_DECLARE_PUBLIC(QUndoStack)
48public:
49 QUndoStackPrivate() : index(0), clean_index(0), group(nullptr), undo_limit(0) {}
50
51 QList<QUndoCommand*> command_list;
52 QList<QUndoCommand*> macro_stack;
53 int index;
54 int clean_index;
55 QUndoGroup *group;
56 int undo_limit;
57
58 void setIndex(int idx, bool clean);
59 bool checkUndoLimit();
60
61#ifndef QT_NO_ACTION
62 static void setPrefixedText(QAction *action, const QString &prefix, const QString &defaultText, const QString &text);
63#endif
64};
65
66QT_END_NAMESPACE
67#endif // QT_CONFIG(undostack)
68#endif // QUNDOSTACK_P_H
69

source code of qtbase/src/gui/util/qundostack_p.h