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;
|
CircularProgress *const q_ptr;
|
||||||
CircularProgressDelegate *const delegate;
|
CircularProgressDelegate *const delegate;
|
||||||
Material::ProgressType progressType;
|
Material::ProgressType progressType;
|
||||||
int size;
|
int size;
|
||||||
qreal penWidth;
|
qreal penWidth;
|
||||||
QColor color;
|
QColor color;
|
||||||
bool useThemeColors;
|
bool useThemeColors;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CIRCULARPROGRESS_P_H
|
#endif // CIRCULARPROGRESS_P_H
|
||||||
|
|
|
@ -19,9 +19,9 @@ public:
|
||||||
|
|
||||||
void assignAnimationProperties();
|
void assignAnimationProperties();
|
||||||
|
|
||||||
bool mini;
|
bool mini;
|
||||||
int offsX;
|
int offsX;
|
||||||
int offsY;
|
int offsY;
|
||||||
Qt::Corner corner;
|
Qt::Corner corner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
FlatButtonPrivate::FlatButtonPrivate(FlatButton *q)
|
FlatButtonPrivate::FlatButtonPrivate(FlatButton *q)
|
||||||
: q_ptr(q),
|
: q_ptr(q),
|
||||||
|
ripple(new RippleOverlay),
|
||||||
|
delegate(0),
|
||||||
role(Material::Default),
|
role(Material::Default),
|
||||||
rippleStyle(Material::PositionedRipple),
|
rippleStyle(Material::PositionedRipple),
|
||||||
cornerRadius(3),
|
cornerRadius(3),
|
||||||
|
@ -31,7 +33,7 @@ void FlatButtonPrivate::init()
|
||||||
{
|
{
|
||||||
Q_Q(FlatButton);
|
Q_Q(FlatButton);
|
||||||
|
|
||||||
ripple = new RippleOverlay(q);
|
ripple->setParent(q);
|
||||||
delegate = new FlatButtonDelegate(q);
|
delegate = new FlatButtonDelegate(q);
|
||||||
|
|
||||||
Style &style = Style::instance();
|
Style &style = Style::instance();
|
||||||
|
|
|
@ -21,20 +21,20 @@ public:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
FlatButton *const q_ptr;
|
FlatButton *const q_ptr;
|
||||||
RippleOverlay *ripple;
|
RippleOverlay *const ripple;
|
||||||
FlatButtonDelegate *delegate;
|
FlatButtonDelegate *delegate;
|
||||||
Material::Role role;
|
Material::Role role;
|
||||||
Material::RippleStyle rippleStyle;
|
Material::RippleStyle rippleStyle;
|
||||||
qreal cornerRadius;
|
qreal cornerRadius;
|
||||||
Qt::BGMode bgMode;
|
Qt::BGMode bgMode;
|
||||||
QColor textColor;
|
QColor textColor;
|
||||||
QColor backgroundColor;
|
QColor backgroundColor;
|
||||||
QColor disabledTextColor;
|
QColor disabledTextColor;
|
||||||
bool useThemeColors;
|
bool useThemeColors;
|
||||||
bool showHalo;
|
bool showHalo;
|
||||||
qreal peakOpacity;
|
qreal peakOpacity;
|
||||||
bool useFixedRippleRadius;
|
bool useFixedRippleRadius;
|
||||||
qreal fixedRippleRadius;
|
qreal fixedRippleRadius;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLATBUTTON_P_H
|
#endif // FLATBUTTON_P_H
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
#include "lib/rippleoverlay.h"
|
#include "lib/rippleoverlay.h"
|
||||||
|
|
||||||
IconButtonPrivate::IconButtonPrivate(IconButton *q)
|
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);
|
Q_Q(IconButton);
|
||||||
|
|
||||||
ripple = new RippleOverlay(q->parentWidget());
|
|
||||||
|
|
||||||
QSizePolicy policy;
|
QSizePolicy policy;
|
||||||
policy.setWidthForHeight(true);
|
policy.setWidthForHeight(true);
|
||||||
q->setSizePolicy(policy);
|
q->setSizePolicy(policy);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
IconButton *const q_ptr;
|
IconButton *const q_ptr;
|
||||||
RippleOverlay *ripple;
|
RippleOverlay *const ripple;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ICONBUTTON_P_H
|
#endif // ICONBUTTON_P_H
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
ProgressPrivate::ProgressPrivate(Progress *q)
|
ProgressPrivate::ProgressPrivate(Progress *q)
|
||||||
: q_ptr(q),
|
: q_ptr(q),
|
||||||
delegate(0),
|
delegate(new ProgressDelegate(q)),
|
||||||
progressType(Material::IndeterminateProgress),
|
progressType(Material::IndeterminateProgress),
|
||||||
useThemeColors(true)
|
useThemeColors(true)
|
||||||
{
|
{
|
||||||
|
@ -22,8 +22,6 @@ void ProgressPrivate::init()
|
||||||
{
|
{
|
||||||
Q_Q(Progress);
|
Q_Q(Progress);
|
||||||
|
|
||||||
delegate = new ProgressDelegate(q);
|
|
||||||
|
|
||||||
QPropertyAnimation *animation;
|
QPropertyAnimation *animation;
|
||||||
|
|
||||||
animation = new QPropertyAnimation(q);
|
animation = new QPropertyAnimation(q);
|
||||||
|
|
|
@ -18,12 +18,12 @@ public:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
Progress *const q_ptr;
|
Progress *const q_ptr;
|
||||||
ProgressDelegate *delegate;
|
ProgressDelegate *const delegate;
|
||||||
Material::ProgressType progressType;
|
Material::ProgressType progressType;
|
||||||
QColor progressColor;
|
QColor progressColor;
|
||||||
QColor backgroundColor;
|
QColor backgroundColor;
|
||||||
bool useThemeColors;
|
bool useThemeColors;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROGRESS_P_H
|
#endif // PROGRESS_P_H
|
||||||
|
|
|
@ -46,19 +46,19 @@ void RadioButtonPrivate::init()
|
||||||
|
|
||||||
QPropertyAnimation *animation;
|
QPropertyAnimation *animation;
|
||||||
|
|
||||||
animation = new QPropertyAnimation(checkedIcon, "iconSize");
|
animation = new QPropertyAnimation(checkedIcon, "iconSize", q);
|
||||||
animation->setDuration(250);
|
animation->setDuration(250);
|
||||||
machine->addDefaultAnimation(animation);
|
machine->addDefaultAnimation(animation);
|
||||||
|
|
||||||
animation = new QPropertyAnimation(uncheckedIcon, "iconSize");
|
animation = new QPropertyAnimation(uncheckedIcon, "iconSize", q);
|
||||||
animation->setDuration(250);
|
animation->setDuration(250);
|
||||||
machine->addDefaultAnimation(animation);
|
machine->addDefaultAnimation(animation);
|
||||||
|
|
||||||
animation = new QPropertyAnimation(uncheckedIcon, "opacity");
|
animation = new QPropertyAnimation(uncheckedIcon, "opacity", q);
|
||||||
animation->setDuration(250);
|
animation->setDuration(250);
|
||||||
machine->addDefaultAnimation(animation);
|
machine->addDefaultAnimation(animation);
|
||||||
|
|
||||||
animation = new QPropertyAnimation(checkedIcon, "opacity");
|
animation = new QPropertyAnimation(checkedIcon, "opacity", q);
|
||||||
animation->setDuration(250);
|
animation->setDuration(250);
|
||||||
machine->addDefaultAnimation(animation);
|
machine->addDefaultAnimation(animation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,11 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
RaisedButtonPrivate::RaisedButtonPrivate(RaisedButton *q)
|
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);
|
Q_Q(RaisedButton);
|
||||||
|
|
||||||
machine = new QStateMachine(q);
|
machine->setParent(q);
|
||||||
|
|
||||||
q->setTextColor(Qt::white);
|
q->setTextColor(Qt::white);
|
||||||
q->setPeakOpacity(0.25);
|
q->setPeakOpacity(0.25);
|
||||||
|
|
||||||
effect = new QGraphicsDropShadowEffect;
|
|
||||||
effect->setBlurRadius(7);
|
effect->setBlurRadius(7);
|
||||||
effect->setOffset(QPointF(0, 0));
|
effect->setOffset(QPointF(0, 0));
|
||||||
effect->setColor(QColor(0, 0, 0, 60));
|
effect->setColor(QColor(0, 0, 0, 60));
|
||||||
q->setGraphicsEffect(effect);
|
q->setGraphicsEffect(effect);
|
||||||
|
|
||||||
normalState = new QState;
|
|
||||||
pressedState = new QState;
|
|
||||||
|
|
||||||
machine->addState(normalState);
|
machine->addState(normalState);
|
||||||
machine->addState(pressedState);
|
machine->addState(pressedState);
|
||||||
|
|
||||||
|
|
|
@ -17,11 +17,11 @@ public:
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
QStateMachine *machine;
|
QStateMachine *machine;
|
||||||
QState *normalState;
|
QState *const normalState;
|
||||||
QState *pressedState;
|
QState *const pressedState;
|
||||||
QGraphicsDropShadowEffect *effect;
|
QGraphicsDropShadowEffect *const effect;
|
||||||
QColor disabledBackgroundColor;
|
QColor disabledBackgroundColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RAISEDBUTTON_P_H
|
#endif // RAISEDBUTTON_P_H
|
||||||
|
|
|
@ -11,7 +11,7 @@ AppBarExamples::AppBarExamples(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
Progress *p = new Progress;
|
Progress *p = new Progress;
|
||||||
p->setProgressType(Material::DeterminateProgress);
|
p->setProgressType(Material::IndeterminateProgress);
|
||||||
p->setMinimum(0);
|
p->setMinimum(0);
|
||||||
p->setMaximum(99);
|
p->setMaximum(99);
|
||||||
p->setValue(22);
|
p->setValue(22);
|
||||||
|
@ -25,7 +25,7 @@ AppBarExamples::AppBarExamples(QWidget *parent)
|
||||||
l->addWidget(p);
|
l->addWidget(p);
|
||||||
|
|
||||||
CircularProgress *cp = new CircularProgress;
|
CircularProgress *cp = new CircularProgress;
|
||||||
cp->setProgressType(Material::DeterminateProgress);
|
cp->setProgressType(Material::IndeterminateProgress);
|
||||||
cp->setMinimum(0);
|
cp->setMinimum(0);
|
||||||
cp->setMaximum(99);
|
cp->setMaximum(99);
|
||||||
cp->setValue(90);
|
cp->setValue(90);
|
||||||
|
|
|
@ -11,7 +11,7 @@ IconButtonExamples::IconButtonExamples(QWidget *parent)
|
||||||
QLayout *layout = widget()->layout();
|
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;
|
ExampleView *view = new ExampleView;
|
||||||
view->setWidget(iconButton);
|
view->setWidget(iconButton);
|
||||||
|
|
Loading…
Reference in New Issue