diff --git a/components/circularprogress_p.h b/components/circularprogress_p.h index 9ecf714..a968865 100644 --- a/components/circularprogress_p.h +++ b/components/circularprogress_p.h @@ -20,11 +20,11 @@ public: CircularProgress *const q_ptr; CircularProgressDelegate *const delegate; - Material::ProgressType progressType; - int size; - qreal penWidth; - QColor color; - bool useThemeColors; + Material::ProgressType progressType; + int size; + qreal penWidth; + QColor color; + bool useThemeColors; }; #endif // CIRCULARPROGRESS_P_H diff --git a/components/fab_p.h b/components/fab_p.h index 2696b6f..99a7b80 100644 --- a/components/fab_p.h +++ b/components/fab_p.h @@ -19,9 +19,9 @@ public: void assignAnimationProperties(); - bool mini; - int offsX; - int offsY; + bool mini; + int offsX; + int offsY; Qt::Corner corner; }; diff --git a/components/flatbutton.cpp b/components/flatbutton.cpp index 6af0a01..7f8016b 100644 --- a/components/flatbutton.cpp +++ b/components/flatbutton.cpp @@ -11,6 +11,8 @@ FlatButtonPrivate::FlatButtonPrivate(FlatButton *q) : q_ptr(q), + ripple(new RippleOverlay), + delegate(0), role(Material::Default), rippleStyle(Material::PositionedRipple), cornerRadius(3), @@ -31,7 +33,7 @@ void FlatButtonPrivate::init() { Q_Q(FlatButton); - ripple = new RippleOverlay(q); + ripple->setParent(q); delegate = new FlatButtonDelegate(q); Style &style = Style::instance(); diff --git a/components/flatbutton_p.h b/components/flatbutton_p.h index 8922560..da47160 100644 --- a/components/flatbutton_p.h +++ b/components/flatbutton_p.h @@ -21,20 +21,20 @@ public: void init(); FlatButton *const q_ptr; - RippleOverlay *ripple; - FlatButtonDelegate *delegate; - Material::Role role; - Material::RippleStyle rippleStyle; - qreal cornerRadius; - Qt::BGMode bgMode; - QColor textColor; - QColor backgroundColor; - QColor disabledTextColor; - bool useThemeColors; - bool showHalo; - qreal peakOpacity; - bool useFixedRippleRadius; - qreal fixedRippleRadius; + RippleOverlay *const ripple; + FlatButtonDelegate *delegate; + Material::Role role; + Material::RippleStyle rippleStyle; + qreal cornerRadius; + Qt::BGMode bgMode; + QColor textColor; + QColor backgroundColor; + QColor disabledTextColor; + bool useThemeColors; + bool showHalo; + qreal peakOpacity; + bool useFixedRippleRadius; + qreal fixedRippleRadius; }; #endif // FLATBUTTON_P_H diff --git a/components/iconbutton.cpp b/components/iconbutton.cpp index 08c9daa..3afdf83 100644 --- a/components/iconbutton.cpp +++ b/components/iconbutton.cpp @@ -6,7 +6,8 @@ #include "lib/rippleoverlay.h" IconButtonPrivate::IconButtonPrivate(IconButton *q) - : q_ptr(q) + : q_ptr(q), + ripple(new RippleOverlay(q->parentWidget())) { } @@ -14,8 +15,6 @@ void IconButtonPrivate::init() { Q_Q(IconButton); - ripple = new RippleOverlay(q->parentWidget()); - QSizePolicy policy; policy.setWidthForHeight(true); q->setSizePolicy(policy); diff --git a/components/iconbutton_p.h b/components/iconbutton_p.h index c21e46b..94be5cc 100644 --- a/components/iconbutton_p.h +++ b/components/iconbutton_p.h @@ -17,7 +17,7 @@ public: void init(); IconButton *const q_ptr; - RippleOverlay *ripple; + RippleOverlay *const ripple; }; #endif // ICONBUTTON_P_H diff --git a/components/progress.cpp b/components/progress.cpp index c913862..a34e103 100644 --- a/components/progress.cpp +++ b/components/progress.cpp @@ -8,7 +8,7 @@ ProgressPrivate::ProgressPrivate(Progress *q) : q_ptr(q), - delegate(0), + delegate(new ProgressDelegate(q)), progressType(Material::IndeterminateProgress), useThemeColors(true) { @@ -22,8 +22,6 @@ void ProgressPrivate::init() { Q_Q(Progress); - delegate = new ProgressDelegate(q); - QPropertyAnimation *animation; animation = new QPropertyAnimation(q); diff --git a/components/progress_p.h b/components/progress_p.h index c7307fa..eecd29f 100644 --- a/components/progress_p.h +++ b/components/progress_p.h @@ -18,12 +18,12 @@ public: void init(); - Progress *const q_ptr; - ProgressDelegate *delegate; - Material::ProgressType progressType; - QColor progressColor; - QColor backgroundColor; - bool useThemeColors; + Progress *const q_ptr; + ProgressDelegate *const delegate; + Material::ProgressType progressType; + QColor progressColor; + QColor backgroundColor; + bool useThemeColors; }; #endif // PROGRESS_P_H diff --git a/components/radiobutton.cpp b/components/radiobutton.cpp index 6bab9e6..d91e848 100644 --- a/components/radiobutton.cpp +++ b/components/radiobutton.cpp @@ -46,19 +46,19 @@ void RadioButtonPrivate::init() QPropertyAnimation *animation; - animation = new QPropertyAnimation(checkedIcon, "iconSize"); + animation = new QPropertyAnimation(checkedIcon, "iconSize", q); animation->setDuration(250); machine->addDefaultAnimation(animation); - animation = new QPropertyAnimation(uncheckedIcon, "iconSize"); + animation = new QPropertyAnimation(uncheckedIcon, "iconSize", q); animation->setDuration(250); machine->addDefaultAnimation(animation); - animation = new QPropertyAnimation(uncheckedIcon, "opacity"); + animation = new QPropertyAnimation(uncheckedIcon, "opacity", q); animation->setDuration(250); machine->addDefaultAnimation(animation); - animation = new QPropertyAnimation(checkedIcon, "opacity"); + animation = new QPropertyAnimation(checkedIcon, "opacity", q); animation->setDuration(250); machine->addDefaultAnimation(animation); } diff --git a/components/raisedbutton.cpp b/components/raisedbutton.cpp index 1c74f34..ff80aa1 100644 --- a/components/raisedbutton.cpp +++ b/components/raisedbutton.cpp @@ -11,7 +11,11 @@ #include RaisedButtonPrivate::RaisedButtonPrivate(RaisedButton *q) - : FlatButtonPrivate(q) + : FlatButtonPrivate(q), + machine(new QStateMachine), + normalState(new QState), + pressedState(new QState), + effect(new QGraphicsDropShadowEffect) { } @@ -23,20 +27,16 @@ void RaisedButtonPrivate::init() { Q_Q(RaisedButton); - machine = new QStateMachine(q); + machine->setParent(q); q->setTextColor(Qt::white); q->setPeakOpacity(0.25); - effect = new QGraphicsDropShadowEffect; effect->setBlurRadius(7); effect->setOffset(QPointF(0, 0)); effect->setColor(QColor(0, 0, 0, 60)); q->setGraphicsEffect(effect); - normalState = new QState; - pressedState = new QState; - machine->addState(normalState); machine->addState(pressedState); diff --git a/components/raisedbutton_p.h b/components/raisedbutton_p.h index a09ee46..f0dc15b 100644 --- a/components/raisedbutton_p.h +++ b/components/raisedbutton_p.h @@ -17,11 +17,11 @@ public: void init(); - QStateMachine *machine; - QState *normalState; - QState *pressedState; - QGraphicsDropShadowEffect *effect; - QColor disabledBackgroundColor; + QStateMachine *machine; + QState *const normalState; + QState *const pressedState; + QGraphicsDropShadowEffect *const effect; + QColor disabledBackgroundColor; }; #endif // RAISEDBUTTON_P_H diff --git a/examples/appbarexamples.cpp b/examples/appbarexamples.cpp index 23cacbf..ee671be 100644 --- a/examples/appbarexamples.cpp +++ b/examples/appbarexamples.cpp @@ -11,7 +11,7 @@ AppBarExamples::AppBarExamples(QWidget *parent) : QWidget(parent) { Progress *p = new Progress; - p->setProgressType(Material::DeterminateProgress); + p->setProgressType(Material::IndeterminateProgress); p->setMinimum(0); p->setMaximum(99); p->setValue(22); @@ -25,7 +25,7 @@ AppBarExamples::AppBarExamples(QWidget *parent) l->addWidget(p); CircularProgress *cp = new CircularProgress; - cp->setProgressType(Material::DeterminateProgress); + cp->setProgressType(Material::IndeterminateProgress); cp->setMinimum(0); cp->setMaximum(99); cp->setValue(90); diff --git a/examples/iconbuttonexamples.cpp b/examples/iconbuttonexamples.cpp index c0105b4..2929deb 100644 --- a/examples/iconbuttonexamples.cpp +++ b/examples/iconbuttonexamples.cpp @@ -11,7 +11,7 @@ IconButtonExamples::IconButtonExamples(QWidget *parent) QLayout *layout = widget()->layout(); { - IconButton *iconButton = new IconButton(QIcon("../qt-material-widgets/face.svg")); + IconButton *iconButton = new IconButton(QIcon("../qt-material-widgets/face.svg"), this); ExampleView *view = new ExampleView; view->setWidget(iconButton);