qstatemachine.sip 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // qstatemachine.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtStateMachine 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 QStateMachine : public QState
  22. {
  23. %TypeHeaderCode
  24. #include <qstatemachine.h>
  25. %End
  26. public:
  27. class SignalEvent : public QEvent /NoDefaultCtors/
  28. {
  29. %TypeHeaderCode
  30. #include <qstatemachine.h>
  31. %End
  32. public:
  33. virtual ~SignalEvent();
  34. QObject *sender() const;
  35. int signalIndex() const;
  36. QList<QVariant> arguments() const;
  37. };
  38. class WrappedEvent : public QEvent /NoDefaultCtors/
  39. {
  40. %TypeHeaderCode
  41. #include <qstatemachine.h>
  42. %End
  43. public:
  44. virtual ~WrappedEvent();
  45. QObject *object() const;
  46. QEvent *event() const;
  47. };
  48. enum EventPriority
  49. {
  50. NormalPriority,
  51. HighPriority,
  52. };
  53. enum Error
  54. {
  55. NoError,
  56. NoInitialStateError,
  57. NoDefaultStateInHistoryStateError,
  58. NoCommonAncestorForTransitionError,
  59. StateMachineChildModeSetToParallelError,
  60. };
  61. explicit QStateMachine(QObject *parent /TransferThis/ = 0);
  62. QStateMachine(QState::ChildMode childMode, QObject *parent /TransferThis/ = 0);
  63. virtual ~QStateMachine();
  64. void addState(QAbstractState *state /Transfer/);
  65. void removeState(QAbstractState *state /TransferBack/);
  66. QStateMachine::Error error() const;
  67. QString errorString() const;
  68. void clearError();
  69. bool isRunning() const;
  70. bool isAnimated() const;
  71. void setAnimated(bool enabled);
  72. void addDefaultAnimation(QAbstractAnimation *animation /GetWrapper/);
  73. %MethodCode
  74. // We want to keep a reference to the animation but this is in addition to the
  75. // existing ones and does not replace them - so we can't use /KeepReference/.
  76. sipCpp->addDefaultAnimation(a0);
  77. // Use the user object as a list of the references.
  78. PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
  79. if (!user)
  80. {
  81. user = PyList_New(0);
  82. sipSetUserObject((sipSimpleWrapper *)sipSelf, user);
  83. }
  84. if (user)
  85. PyList_Append(user, a0Wrapper);
  86. %End
  87. QList<QAbstractAnimation *> defaultAnimations() const;
  88. void removeDefaultAnimation(QAbstractAnimation *animation /GetWrapper/);
  89. %MethodCode
  90. // Discard the extra animation reference that we took in addDefaultAnimation().
  91. sipCpp->removeDefaultAnimation(a0);
  92. // Use the user object as a list of the references.
  93. PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
  94. if (user)
  95. {
  96. Py_ssize_t i = 0;
  97. // Note that we deal with an object appearing in the list more than once.
  98. while (i < PyList_Size(user))
  99. if (PyList_GetItem(user, i) == a0Wrapper)
  100. PyList_SetSlice(user, i, i + 1, NULL);
  101. else
  102. ++i;
  103. }
  104. %End
  105. QState::RestorePolicy globalRestorePolicy() const;
  106. void setGlobalRestorePolicy(QState::RestorePolicy restorePolicy);
  107. void postEvent(QEvent *event /Transfer/, QStateMachine::EventPriority priority = QStateMachine::NormalPriority);
  108. int postDelayedEvent(QEvent *event /Transfer/, int delay);
  109. bool cancelDelayedEvent(int id);
  110. QSet<QAbstractState *> configuration() const;
  111. virtual bool eventFilter(QObject *watched, QEvent *event);
  112. public slots:
  113. void start();
  114. void stop();
  115. void setRunning(bool running);
  116. signals:
  117. void started();
  118. void stopped();
  119. void runningChanged(bool running);
  120. protected:
  121. virtual void onEntry(QEvent *event);
  122. virtual void onExit(QEvent *event);
  123. virtual bool event(QEvent *e);
  124. };