make sure all animations have a parent
This commit is contained in:
parent
f04c353dfb
commit
4d40f4554c
|
@ -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
|
||||
|
|
|
@ -19,9 +19,9 @@ public:
|
|||
|
||||
void assignAnimationProperties();
|
||||
|
||||
bool mini;
|
||||
int offsX;
|
||||
int offsY;
|
||||
bool mini;
|
||||
int offsX;
|
||||
int offsY;
|
||||
Qt::Corner corner;
|
||||
};
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
void init();
|
||||
|
||||
IconButton *const q_ptr;
|
||||
RippleOverlay *ripple;
|
||||
RippleOverlay *const ripple;
|
||||
};
|
||||
|
||||
#endif // ICONBUTTON_P_H
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,11 @@
|
|||
#include <QDebug>
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue