diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-03-07 08:59:39 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-03-07 12:49:21 +0000 |
commit | 59e9c4956cfc5163c1fc411c6c567a4c753b4e9a (patch) | |
tree | 424e3e419931168c8bc5387333f2b33be96a9161 | |
parent | e97311ad750807db94cac69db728da03d1c59837 (diff) |
QUndoStack: add more Q_PROPERTYs
This is the first step in being able to use the undo framework in QML.
The next step would be to separate it out of Qt Widgets so that a pure
Qt Quick application doesn't need to rely on it.
Note that QUndoCommand is not a QObject, so we cannot expose its text
member as a property until Qt 6.
[ChangeLog][QUndoStack] Exposed canUndo, canRedo, undoText, redoText
and clean as Q_PROPERTYs.
Task-number: QTBUG-40040
Change-Id: Ida7ec03f871f0db7fdcc5b90ed200024c5cb348e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/widgets/util/qundostack.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h index 4be24eadab..b5716b2e9b 100644 --- a/src/widgets/util/qundostack.h +++ b/src/widgets/util/qundostack.h @@ -90,6 +90,11 @@ class Q_WIDGETS_EXPORT QUndoStack : public QObject Q_DECLARE_PRIVATE(QUndoStack) Q_PROPERTY(bool active READ isActive WRITE setActive) Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit) + Q_PROPERTY(bool canUndo READ canUndo NOTIFY canUndoChanged) + Q_PROPERTY(bool canRedo READ canRedo NOTIFY canRedoChanged) + Q_PROPERTY(QString undoText READ undoText NOTIFY undoTextChanged) + Q_PROPERTY(QString redoText READ redoText NOTIFY redoTextChanged) + Q_PROPERTY(bool clean READ isClean NOTIFY cleanChanged) public: explicit QUndoStack(QObject *parent = nullptr); |