The QSignalTransition 类提供基于 Qt 信号的过渡。 更多...
头: | #include <QSignalTransition> |
qmake: | QT += core |
Since: | Qt 4.6 |
继承: | QAbstractTransition |
QSignalTransition (QState * sourceState = Q_NULLPTR) | |
QSignalTransition (const QObject * sender , const char * signal , QState * sourceState = Q_NULLPTR) | |
QSignalTransition (const QObject * sender , PointerToMemberFunction signal , QState * sourceState = Q_NULLPTR) | |
~QSignalTransition () | |
QObject * | senderObject () const |
void | setSenderObject (const QObject * sender ) |
void | setSignal (const QByteArray & signal ) |
QByteArray | signal () const |
void | senderObjectChanged () |
void | signalChanged () |
virtual bool | event (QEvent * e ) |
virtual bool | eventTest (QEvent * event ) |
virtual void | onTransition (QEvent * event ) |
The QSignalTransition 类提供基于 Qt 信号的过渡。
通常,将使用重载 QState::addTransition () 接受发送器和信号作为自变量,而不是创建 QSignalTransition 对象直接。 QSignalTransition 属于 状态机框架 .
可以子类化 QSignalTransition 并重实现 eventTest () to make a signal transition conditional; the event object passed to eventTest () 将是 QStateMachine::SignalEvent object. Example:
class CheckedTransition : public QSignalTransition { public: CheckedTransition(QCheckBox *check) : QSignalTransition(check, SIGNAL(stateChanged(int))) {} protected: bool eventTest(QEvent *e) { if (!QSignalTransition::eventTest(e)) return false; QStateMachine::SignalEvent *se = static_cast<QStateMachine::SignalEvent*>(e); return (se->arguments().at(0).toInt() == Qt::Checked); } }; ... QCheckBox *check = new QCheckBox(); check->setTristate(true); QState *s1 = new QState(); QState *s2 = new QState(); CheckedTransition *t1 = new CheckedTransition(check); t1->setTargetState(s2); s1->addTransition(t1);
This property holds the sender object that this signal transition is associated with
访问函数:
QObject * | senderObject () const |
void | setSenderObject (const QObject * sender ) |
通知程序信号:
void | senderObjectChanged () | [见下文注意事项] |
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
This property holds the signal that this signal transition is associated with
访问函数:
QByteArray | signal () const |
void | setSignal (const QByteArray & signal ) |
通知程序信号:
void | signalChanged () | [见下文注意事项] |
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
构造新的信号过渡采用给定 sourceState .
Constructs a new signal transition associated with the given signal 为给定 sender ,和采用给定 sourceState .
这是重载函数。
Constructs a new signal transition associated with the given signal 为给定 sender object and with the given sourceState . This constructor is enabled if the compiler supports delegating constructors, as indicated by the presence of the macro Q_COMPILER_DELEGATING_CONSTRUCTORS.
该函数在 Qt 5.7 引入。
销毁此信号过渡。
[virtual protected]
bool
QSignalTransition::
event
(
QEvent
*
e
)
重实现自 QObject::event ().
[virtual protected]
bool
QSignalTransition::
eventTest
(
QEvent
*
event
)
重实现自 QAbstractTransition::eventTest ().
默认实现返回
true
若
event
是
QStateMachine::SignalEvent
object and the event's sender and signal index match this transition, and returns
false
否则。
[virtual protected]
void
QSignalTransition::
onTransition
(
QEvent
*
event
)
重实现自 QAbstractTransition::onTransition ().
Returns the sender object associated with this signal transition.
注意: Getter 函数对于特性 senderObject .
另请参阅 setSenderObject ().
[signal]
void
QSignalTransition::
senderObjectChanged
()
此信号被发射当 senderObject 特性改变。
该函数在 Qt 5.4 引入。
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
注意: 通知程序信号对于特性 senderObject .
另请参阅 QSignalTransition::senderObject .
设置 sender object associated with this signal transition.
注意: Setter 函数对于特性 senderObject .
另请参阅 senderObject ().
设置 signal associated with this signal transition.
注意: Setter 函数对于特性 signal .
另请参阅 signal ().
Returns the signal associated with this signal transition.
注意: Getter 函数对于特性 signal .
另请参阅 setSignal ().
[signal]
void
QSignalTransition::
signalChanged
()
此信号被发射,当信号特性改变时。
该函数在 Qt 5.4 引入。
注意: 这是私有信号。它可以用于信号连接,但不能由用户发射。
注意: 通知程序信号对于特性 signal .
另请参阅 QSignalTransition::signal .