File indexing completed on 2026-09-14 09:19:37
0001
0002
0003
0004
0005 #ifndef QUNDOGROUP_H
0006 #define QUNDOGROUP_H
0007
0008 #include <QtGui/qtguiglobal.h>
0009 #include <QtCore/qobject.h>
0010 #include <QtCore/qstring.h>
0011
0012 QT_REQUIRE_CONFIG(undogroup);
0013
0014 QT_BEGIN_NAMESPACE
0015
0016 class QUndoGroupPrivate;
0017 class QUndoStack;
0018 class QAction;
0019
0020 class Q_GUI_EXPORT QUndoGroup : public QObject
0021 {
0022 Q_OBJECT
0023 Q_DECLARE_PRIVATE(QUndoGroup)
0024
0025 public:
0026 explicit QUndoGroup(QObject *parent = nullptr);
0027 ~QUndoGroup();
0028
0029 void addStack(QUndoStack *stack);
0030 void removeStack(QUndoStack *stack);
0031 QList<QUndoStack*> stacks() const;
0032 QUndoStack *activeStack() const;
0033
0034 #ifndef QT_NO_ACTION
0035 QAction *createUndoAction(QObject *parent, const QString &prefix = QString()) const;
0036 QAction *createRedoAction(QObject *parent, const QString &prefix = QString()) const;
0037 #endif
0038
0039 bool canUndo() const;
0040 bool canRedo() const;
0041 QString undoText() const;
0042 QString redoText() const;
0043 bool isClean() const;
0044
0045 public Q_SLOTS:
0046 void undo();
0047 void redo();
0048 void setActiveStack(QUndoStack *stack);
0049
0050 Q_SIGNALS:
0051 void activeStackChanged(QUndoStack *stack);
0052 void indexChanged(int idx);
0053 void cleanChanged(bool clean);
0054 void canUndoChanged(bool canUndo);
0055 void canRedoChanged(bool canRedo);
0056 void undoTextChanged(const QString &undoText);
0057 void redoTextChanged(const QString &redoText);
0058
0059 private:
0060 Q_DISABLE_COPY(QUndoGroup)
0061 };
0062
0063 QT_END_NAMESPACE
0064
0065 #endif