make state machine member pointer type
This commit is contained in:
parent
57e77ecc04
commit
309e9eb5a8
|
@ -23,6 +23,8 @@ void RaisedButtonPrivate::init()
|
|||
{
|
||||
Q_Q(RaisedButton);
|
||||
|
||||
machine = new QStateMachine(q);
|
||||
|
||||
q->setTextColor(Qt::white);
|
||||
q->setPeakOpacity(0.25);
|
||||
|
||||
|
@ -35,8 +37,8 @@ void RaisedButtonPrivate::init()
|
|||
normalState = new QState;
|
||||
pressedState = new QState;
|
||||
|
||||
machine.addState(normalState);
|
||||
machine.addState(pressedState);
|
||||
machine->addState(normalState);
|
||||
machine->addState(pressedState);
|
||||
|
||||
normalState->assignProperty(effect, "offset", QPointF(0, 0));
|
||||
normalState->assignProperty(effect, "blurRadius", 7);
|
||||
|
@ -91,8 +93,8 @@ void RaisedButtonPrivate::init()
|
|||
|
||||
//
|
||||
|
||||
machine.setInitialState(normalState);
|
||||
machine.start();
|
||||
machine->setInitialState(normalState);
|
||||
machine->start();
|
||||
}
|
||||
|
||||
RaisedButton::RaisedButton(QWidget *parent)
|
||||
|
@ -140,10 +142,10 @@ bool RaisedButton::event(QEvent *event)
|
|||
|
||||
if (QEvent::EnabledChange == event->type()) {
|
||||
if (isEnabled()) {
|
||||
d->machine.start();
|
||||
d->machine->start();
|
||||
d->effect->setEnabled(true);
|
||||
} else {
|
||||
d->machine.stop();
|
||||
d->machine->stop();
|
||||
d->effect->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,9 @@ public:
|
|||
|
||||
void init();
|
||||
|
||||
QStateMachine machine;
|
||||
QState *normalState;
|
||||
QState *pressedState;
|
||||
QStateMachine *machine;
|
||||
QState *normalState;
|
||||
QState *pressedState;
|
||||
QGraphicsDropShadowEffect *effect;
|
||||
QColor disabledBackgroundColor;
|
||||
};
|
||||
|
|
|
@ -27,15 +27,16 @@ void TogglePrivate::init()
|
|||
Q_Q(Toggle);
|
||||
|
||||
ripple = new RippleOverlay(q->parentWidget());
|
||||
machine = new QStateMachine(q);
|
||||
|
||||
q->setCheckable(true);
|
||||
q->setChecked(false);
|
||||
q->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
machine.addState(offState);
|
||||
machine.addState(onState);
|
||||
machine->addState(offState);
|
||||
machine->addState(onState);
|
||||
|
||||
machine.setInitialState(offState);
|
||||
machine->setInitialState(offState);
|
||||
|
||||
QSignalTransition *transition;
|
||||
QPropertyAnimation *animation;
|
||||
|
@ -101,7 +102,7 @@ void TogglePrivate::init()
|
|||
|
||||
QObject::connect(q, SIGNAL(toggled(bool)), q, SLOT(addRipple()));
|
||||
|
||||
machine.start();
|
||||
machine->start();
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
@ -290,9 +291,9 @@ bool Toggle::event(QEvent *event)
|
|||
{
|
||||
case QEvent::EnabledChange:
|
||||
if (isEnabled()) {
|
||||
d->machine.start();
|
||||
d->machine->start();
|
||||
} else {
|
||||
d->machine.stop();
|
||||
d->machine->stop();
|
||||
}
|
||||
break;
|
||||
case QEvent::ParentChange:
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
QState *const offState;
|
||||
QState *const onState;
|
||||
RippleOverlay *ripple;
|
||||
QStateMachine machine;
|
||||
QStateMachine *machine;
|
||||
Qt::Orientation orientation;
|
||||
QColor disabledColor;
|
||||
QColor activeColor;
|
||||
|
|
Loading…
Reference in New Issue