From e33478ad497dc93043bcdb6182a8757ccb6e53c0 Mon Sep 17 00:00:00 2001 From: laserpants Date: Tue, 21 Jun 2016 15:45:39 +0300 Subject: [PATCH] make sure all animations have a parent --- components/toggle.cpp | 5 +++-- components/toggle_p.h | 16 ++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/components/toggle.cpp b/components/toggle.cpp index a5978b1..42d84c4 100644 --- a/components/toggle.cpp +++ b/components/toggle.cpp @@ -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); diff --git a/components/toggle_p.h b/components/toggle_p.h index 7cc2306..6e15b3b 100644 --- a/components/toggle_p.h +++ b/components/toggle_p.h @@ -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