Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qundogroup.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 QUNDOGROUP_H
6#define QUNDOGROUP_H
7
8#include <QtGui/qtguiglobal.h>
9#include <QtCore/qobject.h>
10#include <QtCore/qstring.h>
11
13
14QT_BEGIN_NAMESPACE
15
16class QUndoGroupPrivate;
17class QUndoStack;
18class QAction;
19
20class Q_GUI_EXPORT QUndoGroup : public QObject
21{
22 Q_OBJECT
23 Q_DECLARE_PRIVATE(QUndoGroup)
24
25public:
26 explicit QUndoGroup(QObject *parent = nullptr);
27 ~QUndoGroup();
28
29 void addStack(QUndoStack *stack);
30 void removeStack(QUndoStack *stack);
31 QList<QUndoStack*> stacks() const;
32 QUndoStack *activeStack() const;
33
34#ifndef QT_NO_ACTION
35 QAction *createUndoAction(QObject *parent, const QString &prefix = QString()) const;
36 QAction *createRedoAction(QObject *parent, const QString &prefix = QString()) const;
37#endif // QT_NO_ACTION
38
39 bool canUndo() const;
40 bool canRedo() const;
41 QString undoText() const;
42 QString redoText() const;
43 bool isClean() const;
44
45public Q_SLOTS:
46 void undo();
47 void redo();
48 void setActiveStack(QUndoStack *stack);
49
50Q_SIGNALS:
51 void activeStackChanged(QUndoStack *stack);
52 void indexChanged(int idx);
53 void cleanChanged(bool clean);
54 void canUndoChanged(bool canUndo);
55 void canRedoChanged(bool canRedo);
56 void undoTextChanged(const QString &undoText);
57 void redoTextChanged(const QString &redoText);
58
59private:
60 Q_DISABLE_COPY(QUndoGroup)
61};
62
63QT_END_NAMESPACE
64
65#endif // QUNDOGROUP_H
The QUndoGroup class is a group of QUndoStack objects.
Definition qundogroup.h:21
QT_REQUIRE_CONFIG(undogroup)