qabstracttransition.sip 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // qabstracttransition.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 QAbstractTransition : public QObject
  22. {
  23. %TypeHeaderCode
  24. #include <qabstracttransition.h>
  25. %End
  26. public:
  27. enum TransitionType
  28. {
  29. ExternalTransition,
  30. InternalTransition,
  31. };
  32. QAbstractTransition(QState *sourceState /TransferThis/ = 0);
  33. virtual ~QAbstractTransition();
  34. QState *sourceState() const;
  35. QAbstractState *targetState() const;
  36. void setTargetState(QAbstractState *target /KeepReference=0/);
  37. QList<QAbstractState *> targetStates() const;
  38. void setTargetStates(const QList<QAbstractState *> &targets /KeepReference=0/);
  39. QAbstractTransition::TransitionType transitionType() const;
  40. void setTransitionType(QAbstractTransition::TransitionType type);
  41. QStateMachine *machine() const;
  42. void addAnimation(QAbstractAnimation *animation /GetWrapper/);
  43. %MethodCode
  44. // We want to keep a reference to the animation but this is in addition to the
  45. // existing ones and does not replace them - so we can't use /KeepReference/.
  46. sipCpp->addAnimation(a0);
  47. // Use the user object as a list of the references.
  48. PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
  49. if (!user)
  50. {
  51. user = PyList_New(0);
  52. sipSetUserObject((sipSimpleWrapper *)sipSelf, user);
  53. }
  54. if (user)
  55. PyList_Append(user, a0Wrapper);
  56. %End
  57. void removeAnimation(QAbstractAnimation *animation /GetWrapper/);
  58. %MethodCode
  59. // Discard the extra animation reference that we took in addAnimation().
  60. sipCpp->removeAnimation(a0);
  61. // Use the user object as a list of the references.
  62. PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
  63. if (user)
  64. {
  65. Py_ssize_t i = 0;
  66. // Note that we deal with an object appearing in the list more than once.
  67. while (i < PyList_Size(user))
  68. if (PyList_GetItem(user, i) == a0Wrapper)
  69. PyList_SetSlice(user, i, i + 1, NULL);
  70. else
  71. ++i;
  72. }
  73. %End
  74. QList<QAbstractAnimation *> animations() const;
  75. signals:
  76. void triggered();
  77. void targetStateChanged();
  78. void targetStatesChanged();
  79. protected:
  80. virtual bool eventTest(QEvent *event) = 0;
  81. virtual void onTransition(QEvent *event) = 0;
  82. virtual bool event(QEvent *e);
  83. };