Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QUNDOGROUP_H
5#define QUNDOGROUP_H
6
7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qobject.h>
9#include <QtCore/qstring.h>
10
12
14
16class QUndoStack;
17class QAction;
18
19class Q_GUI_EXPORT QUndoGroup : public QObject
20{
22 Q_DECLARE_PRIVATE(QUndoGroup)
23
24public:
25 explicit QUndoGroup(QObject *parent = nullptr);
27
28 void addStack(QUndoStack *stack);
29 void removeStack(QUndoStack *stack);
30 QList<QUndoStack*> stacks() const;
31 QUndoStack *activeStack() const;
32
33#ifndef QT_NO_ACTION
34 QAction *createUndoAction(QObject *parent, const QString &prefix = QString()) const;
35 QAction *createRedoAction(QObject *parent, const QString &prefix = QString()) const;
36#endif // QT_NO_ACTION
37
38 bool canUndo() const;
39 bool canRedo() const;
40 QString undoText() const;
41 QString redoText() const;
42 bool isClean() const;
43
44public Q_SLOTS:
45 void undo();
46 void redo();
47 void setActiveStack(QUndoStack *stack);
48
50 void activeStackChanged(QUndoStack *stack);
51 void indexChanged(int idx);
52 void cleanChanged(bool clean);
53 void canUndoChanged(bool canUndo);
54 void canRedoChanged(bool canRedo);
55 void undoTextChanged(const QString &undoText);
56 void redoTextChanged(const QString &redoText);
57
58private:
59 Q_DISABLE_COPY(QUndoGroup)
60};
61
63
64#endif // QUNDOGROUP_H
The QAction class provides an abstraction for user commands that can be added to different user inter...
Definition qaction.h:30
\inmodule QtCore
Definition qobject.h:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QUndoGroup class is a group of QUndoStack objects.
Definition qundogroup.h:20
void canUndoChanged(bool canUndo)
This signal is emitted whenever the active stack emits QUndoStack::canUndoChanged() or the active sta...
void cleanChanged(bool clean)
This signal is emitted whenever the active stack emits QUndoStack::cleanChanged() or the active stack...
void redoTextChanged(const QString &redoText)
This signal is emitted whenever the active stack emits QUndoStack::redoTextChanged() or the active st...
void canRedoChanged(bool canRedo)
This signal is emitted whenever the active stack emits QUndoStack::canRedoChanged() or the active sta...
void undoTextChanged(const QString &undoText)
This signal is emitted whenever the active stack emits QUndoStack::undoTextChanged() or the active st...
void activeStackChanged(QUndoStack *stack)
This signal is emitted whenever the active stack of the group changes.
void indexChanged(int idx)
This signal is emitted whenever the active stack emits QUndoStack::indexChanged() or the active stack...
Combined button and popup list for selecting options.
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
stack undo()