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