1// qundostack.sip generated by MetaSIP 2// 3// This file is part of the QtWidgets Python extension module. 4// 5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com> 6// 7// This file is part of PyQt5. 8// 9// This file may be used under the terms of the GNU General Public License 10// version 3.0 as published by the Free Software Foundation and appearing in 11// the file LICENSE included in the packaging of this file. Please review the 12// following information to ensure the GNU General Public License version 3.0 13// requirements will be met: http://www.gnu.org/copyleft/gpl.html. 14// 15// If you do not wish to use this file under the terms of the GPL version 3.0 16// then you may purchase a commercial license. For more information contact 17// info@riverbankcomputing.com. 18// 19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21 22 23class QUndoCommand /Supertype=sip.wrapper/ 24{ 25%TypeHeaderCode 26#include <qundostack.h> 27%End 28 29public: 30 explicit QUndoCommand(QUndoCommand *parent /TransferThis/ = 0); 31 QUndoCommand(const QString &text, QUndoCommand *parent /TransferThis/ = 0); 32 virtual ~QUndoCommand(); 33 virtual int id() const; 34 virtual bool mergeWith(const QUndoCommand *other); 35 virtual void redo(); 36 void setText(const QString &text); 37 QString text() const; 38 virtual void undo(); 39 int childCount() const; 40 const QUndoCommand *child(int index) const; 41 QString actionText() const; 42%If (Qt_5_9_0 -) 43 bool isObsolete() const; 44%End 45%If (Qt_5_9_0 -) 46 void setObsolete(bool obsolete); 47%End 48 49private: 50 QUndoCommand(const QUndoCommand &); 51}; 52 53class QUndoStack : QObject 54{ 55%TypeHeaderCode 56#include <qundostack.h> 57%End 58 59public: 60 explicit QUndoStack(QObject *parent /TransferThis/ = 0); 61 virtual ~QUndoStack(); 62 void clear(); 63 void push(QUndoCommand *cmd /Transfer/); 64 bool canUndo() const; 65 bool canRedo() const; 66 QString undoText() const; 67 QString redoText() const; 68 int count() const /__len__/; 69 int index() const; 70 QString text(int idx) const; 71 QAction *createUndoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/; 72 QAction *createRedoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/; 73 bool isActive() const; 74 bool isClean() const; 75 int cleanIndex() const; 76 void beginMacro(const QString &text); 77 void endMacro(); 78 79public slots: 80 void redo(); 81 void setActive(bool active = true); 82 void setClean(); 83 void setIndex(int idx); 84 void undo(); 85%If (Qt_5_8_0 -) 86 void resetClean(); 87%End 88 89signals: 90 void canRedoChanged(bool canRedo); 91 void canUndoChanged(bool canUndo); 92 void cleanChanged(bool clean); 93 void indexChanged(int idx); 94 void redoTextChanged(const QString &redoText); 95 void undoTextChanged(const QString &undoText); 96 97public: 98 void setUndoLimit(int limit); 99 int undoLimit() const; 100 const QUndoCommand *command(int index) const; 101}; 102