make sure all animations have a parent

This commit is contained in:
laserpants 2016-06-21 15:45:39 +03:00
parent 264e4c71ed
commit e33478ad49
2 changed files with 11 additions and 10 deletions

View File

@ -17,6 +17,8 @@ TogglePrivate::TogglePrivate(Toggle *q)
thumb(new ToggleThumb(q)), thumb(new ToggleThumb(q)),
offState(new QState), offState(new QState),
onState(new QState), onState(new QState),
ripple(new RippleOverlay(q->parentWidget())),
machine(new QStateMachine),
orientation(Qt::Horizontal), orientation(Qt::Horizontal),
useThemeColors(true) useThemeColors(true)
{ {
@ -26,8 +28,7 @@ void TogglePrivate::init()
{ {
Q_Q(Toggle); Q_Q(Toggle);
ripple = new RippleOverlay(q->parentWidget()); machine->setParent(q);
machine = new QStateMachine(q);
q->setCheckable(true); q->setCheckable(true);
q->setChecked(false); q->setChecked(false);

View File

@ -26,14 +26,14 @@ public:
ToggleThumb *const thumb; ToggleThumb *const thumb;
QState *const offState; QState *const offState;
QState *const onState; QState *const onState;
RippleOverlay *ripple; RippleOverlay *const ripple;
QStateMachine *machine; QStateMachine *const machine;
Qt::Orientation orientation; Qt::Orientation orientation;
QColor disabledColor; QColor disabledColor;
QColor activeColor; QColor activeColor;
QColor inactiveColor; QColor inactiveColor;
QColor trackColor; QColor trackColor;
bool useThemeColors; bool useThemeColors;
}; };
#endif // TOGGLE_P_H #endif // TOGGLE_P_H