• PySide 模块
  • PySide.QtCore
  • 内容表

    上一话题

    QAbstractTransition

    下一话题

    QEventTransition

    QSignalTransition

    注意

    该类在 Qt4.6 引入

    概要

    函数

    详细描述

    PySide.QtCore.QSignalTransition class provides a transition based on a Qt signal.

    Typically you would use the overload of QState.addTransition() that takes a sender and signal as arguments, rather than creating PySide.QtCore.QSignalTransition objects directly. PySide.QtCore.QSignalTransition is part of 状态机框架 .

    You can subclass PySide.QtCore.QSignalTransition and reimplement PySide.QtCore.QSignalTransition.eventTest() to make a signal transition conditional; the event object passed to PySide.QtCore.QSignalTransition.eventTest() will be a 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);
    									
    class PySide.QtCore. QSignalTransition ( arg__1 [ , arg__2=None ] )
    class PySide.QtCore. QSignalTransition ( sender , signal [ , sourceState=None ] )
    class PySide.QtCore. QSignalTransition ( [ sourceState=None ] )
    参数:

    Constructs a new signal transition associated with the given signal 为给定 sender ,和采用给定 sourceState .

    Constructs a new signal transition with the given sourceState .

    PySide.QtCore.QSignalTransition. senderObject ( )
    返回类型: PySide.QtCore.QObject

    This property holds the sender object that this signal transition is associated with.

    PySide.QtCore.QSignalTransition. setSenderObject ( sender )
    参数: sender PySide.QtCore.QObject

    This property holds the sender object that this signal transition is associated with.

    PySide.QtCore.QSignalTransition. setSignal ( signal )
    参数: signal PySide.QtCore.QByteArray

    This property holds the signal that this signal transition is associated with.

    PySide.QtCore.QSignalTransition. signal ( )
    返回类型: PySide.QtCore.QByteArray

    This property holds the signal that this signal transition is associated with.