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)),
offState(new QState),
onState(new QState),
ripple(new RippleOverlay(q->parentWidget())),
machine(new QStateMachine),
orientation(Qt::Horizontal),
useThemeColors(true)
{
@ -26,8 +28,7 @@ void TogglePrivate::init()
{
Q_Q(Toggle);
ripple = new RippleOverlay(q->parentWidget());
machine = new QStateMachine(q);
machine->setParent(q);
q->setCheckable(true);
q->setChecked(false);

View File

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