qundostack.sip 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // qundostack.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. class QUndoCommand /Supertype=PyQt6.sip.wrapper/
  22. {
  23. %TypeHeaderCode
  24. #include <qundostack.h>
  25. %End
  26. public:
  27. explicit QUndoCommand(QUndoCommand *parent /TransferThis/ = 0);
  28. QUndoCommand(const QString &text, QUndoCommand *parent /TransferThis/ = 0);
  29. virtual ~QUndoCommand();
  30. virtual int id() const;
  31. virtual bool mergeWith(const QUndoCommand *other);
  32. virtual void redo();
  33. void setText(const QString &text);
  34. QString text() const;
  35. virtual void undo();
  36. int childCount() const;
  37. const QUndoCommand *child(int index) const;
  38. QString actionText() const;
  39. bool isObsolete() const;
  40. void setObsolete(bool obsolete);
  41. private:
  42. QUndoCommand(const QUndoCommand &);
  43. };
  44. class QUndoStack : public QObject
  45. {
  46. %TypeHeaderCode
  47. #include <qundostack.h>
  48. %End
  49. public:
  50. explicit QUndoStack(QObject *parent /TransferThis/ = 0);
  51. virtual ~QUndoStack();
  52. void clear();
  53. void push(QUndoCommand *cmd /Transfer/);
  54. bool canUndo() const;
  55. bool canRedo() const;
  56. QString undoText() const;
  57. QString redoText() const;
  58. int count() const /__len__/;
  59. int index() const;
  60. QString text(int idx) const;
  61. QAction *createUndoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/;
  62. QAction *createRedoAction(QObject *parent /TransferThis/, const QString &prefix = QString()) const /Factory/;
  63. bool isActive() const;
  64. bool isClean() const;
  65. int cleanIndex() const;
  66. void beginMacro(const QString &text);
  67. void endMacro();
  68. public slots:
  69. void redo();
  70. void setActive(bool active = true);
  71. void setClean();
  72. void setIndex(int idx);
  73. void undo();
  74. void resetClean();
  75. signals:
  76. void canRedoChanged(bool canRedo);
  77. void canUndoChanged(bool canUndo);
  78. void cleanChanged(bool clean);
  79. void indexChanged(int idx);
  80. void redoTextChanged(const QString &redoText);
  81. void undoTextChanged(const QString &undoText);
  82. public:
  83. void setUndoLimit(int limit);
  84. int undoLimit() const;
  85. const QUndoCommand *command(int index) const;
  86. };