CopperSpice API  1.9.1
QAbstractState Class Referenceabstract

The QAbstractState class is the base class for states in a QStateMachine. More...

Inheritance diagram for QAbstractState:
QObject QFinalState QHistoryState QState QStateMachine

Public Signals

void activeChanged (bool active)
 
void entered ()
 
void exited ()
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Methods

 ~QAbstractState ()
 
bool active () const
 
QStateMachinemachine () const
 
QStateparentState () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

 QAbstractState (QState *parent=nullptr)
 
bool event (QEvent *event) override
 
virtual void onEntry (QEvent *event) = 0
 
virtual void onExit (QEvent *event) = 0
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Properties

 active
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 

Detailed Description

The QAbstractState class is the abstract base class for states in a QStateMachine. It defines the interface that all state objects have in common. QAbstractState is part of State Machine.

The entered() signal is emitted when the state has been entered. The exited() signal is emitted when the state has been exited.

The parentState() method returns the state's parent state. The machine() function returns the state machine that the state is part of.

Subclassing

The onEntry() method is called when the state is entered. Reimplement this method to perform custom processing when the state is entered.

The onExit() method is called when the state is exited. Reimplement this method to perform custom processing when the state is exited.

Constructor & Destructor Documentation

QAbstractState::~QAbstractState ( )

Destroys this state object.

QAbstractState::QAbstractState ( QState parent = nullptr)
protected

Constructs a new state with the given parent state.

Method Documentation

bool QAbstractState::active ( ) const

Returns whether this state is active.

See also
activeChanged(), entered(), exited()
void QAbstractState::activeChanged ( bool  active)
signal

This signal is emitted when the active property is changed and active is passed.

See also
QAbstractState::active, entered(), exited()
void QAbstractState::entered ( )
signal

This signal is emitted when the state has been entered (after onEntry() has been called).

bool QAbstractState::event ( QEvent event)
overrideprotectedvirtual
void QAbstractState::exited ( )
signal

This signal is emitted when the state has been exited (after onExit() has been called).

QStateMachine * QAbstractState::machine ( ) const

Returns the state machine this state is part of or nullptr if the state is not part of a state machine.

void QAbstractState::onEntry ( QEvent event)
protectedpure virtual

This function is called when the state is entered. The given event is what caused the state to be entered. Reimplement this function to perform custom processing when the state is entered.

Implemented in QStateMachine::onEntry(), QState::onEntry(), QHistoryState::onEntry(), QFinalState::onEntry()

void QAbstractState::onExit ( QEvent event)
protectedpure virtual

This function is called when the state is exited. The given event is what caused the state to be exited. Reimplement this method to perform custom processing when the state is exited.

Implemented in QStateMachine::onExit(), QState::onExit(), QHistoryState::onExit(), QFinalState::onExit()

QState * QAbstractState::parentState ( ) const

Returns this state's parent state or nullptr if the state has no parent state.

Property Documentation

QAbstractState::active

This property holds the active property of this state. A state is active between entered() and exited() signals.

PropertiesClass Methods
read active
notify activeChanged