| 1 | // Copyright (C) 2016 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 QUNDOVIEW_H |
| 5 | #define QUNDOVIEW_H |
| 6 | |
| 7 | #include <QtWidgets/qtwidgetsglobal.h> |
| 8 | #include <QtWidgets/qlistview.h> |
| 9 | #include <QtCore/qstring.h> |
| 10 | |
| 11 | QT_REQUIRE_CONFIG(undoview); |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QUndoViewPrivate; |
| 16 | class QUndoStack; |
| 17 | class QUndoGroup; |
| 18 | class QIcon; |
| 19 | |
| 20 | |
| 21 | class Q_WIDGETS_EXPORT QUndoView : public QListView |
| 22 | { |
| 23 | Q_OBJECT |
| 24 | Q_DECLARE_PRIVATE(QUndoView) |
| 25 | Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel) |
| 26 | Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon) |
| 27 | |
| 28 | public: |
| 29 | explicit QUndoView(QWidget *parent = nullptr); |
| 30 | explicit QUndoView(QUndoStack *stack, QWidget *parent = nullptr); |
| 31 | #if QT_CONFIG(undogroup) |
| 32 | explicit QUndoView(QUndoGroup *group, QWidget *parent = nullptr); |
| 33 | #endif |
| 34 | ~QUndoView(); |
| 35 | |
| 36 | QUndoStack *stack() const; |
| 37 | #if QT_CONFIG(undogroup) |
| 38 | QUndoGroup *group() const; |
| 39 | #endif |
| 40 | |
| 41 | void setEmptyLabel(const QString &label); |
| 42 | QString emptyLabel() const; |
| 43 | |
| 44 | void setCleanIcon(const QIcon &icon); |
| 45 | QIcon cleanIcon() const; |
| 46 | |
| 47 | public Q_SLOTS: |
| 48 | void setStack(QUndoStack *stack); |
| 49 | #if QT_CONFIG(undogroup) |
| 50 | void setGroup(QUndoGroup *group); |
| 51 | #endif |
| 52 | |
| 53 | private: |
| 54 | Q_DISABLE_COPY(QUndoView) |
| 55 | }; |
| 56 | |
| 57 | QT_END_NAMESPACE |
| 58 | |
| 59 | #endif // QUNDOVIEW_H |
| 60 |
