set fixed ripple radius for FAB
This commit is contained in:
parent
76fe517541
commit
9e93a1b0ff
|
@ -26,6 +26,8 @@ void DialogPrivate::init()
|
|||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
q->setLayout(layout);
|
||||
|
||||
q->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
QWidget *widget = new QWidget;
|
||||
|
||||
widget->setLayout(proxy);
|
||||
|
@ -200,240 +202,3 @@ void Dialog::paintEvent(QPaintEvent *event)
|
|||
|
||||
painter.drawRect(rect());
|
||||
}
|
||||
|
||||
//#include "dialog.h"
|
||||
//#include "dialog_p.h"
|
||||
//#include <QEvent>
|
||||
//#include <QPainter>
|
||||
//#include <QGraphicsDropShadowEffect>
|
||||
//#include <QGraphicsBlurEffect>
|
||||
//#include <QGraphicsOpacityEffect>
|
||||
//#include <QVBoxLayout>
|
||||
//#include <QStackedLayout>
|
||||
//#include <QPushButton>
|
||||
//#include "lib/customshadoweffect.h"
|
||||
//#include "dialog_internal.h"
|
||||
//
|
||||
//DialogPrivate::DialogPrivate(Dialog *q)
|
||||
// : q_ptr(q)
|
||||
//// window(new DialogWindow(q)),
|
||||
//// shadow(new DialogShadow(q))
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//void DialogPrivate::init()
|
||||
//{
|
||||
// Q_Q(Dialog);
|
||||
//
|
||||
// QVBoxLayout *l = new QVBoxLayout;
|
||||
//
|
||||
// layout = new QStackedLayout;
|
||||
// l->addLayout(layout);
|
||||
//
|
||||
// QPushButton *button = new QPushButton;
|
||||
// button->setText("Hello test!");
|
||||
// layout->addWidget(button);
|
||||
//
|
||||
// proxy = new DialogProxy(q, button);
|
||||
// layout->addWidget(proxy);
|
||||
//
|
||||
// //q->setLayout(layout);
|
||||
// q->setLayout(l);
|
||||
//
|
||||
// layout->setCurrentIndex(1);
|
||||
//
|
||||
// button = new QPushButton;
|
||||
// button->setText("one");
|
||||
// l->addWidget(button);
|
||||
//
|
||||
// QObject::connect(button, SIGNAL(pressed()), q, SLOT(pressOne()));
|
||||
//
|
||||
// button = new QPushButton;
|
||||
// button->setText("two");
|
||||
// l->addWidget(button);
|
||||
//
|
||||
// QObject::connect(button, SIGNAL(pressed()), q, SLOT(pressTwo()));
|
||||
//
|
||||
// /*
|
||||
//
|
||||
// return;
|
||||
//
|
||||
// QVBoxLayout *layout = new QVBoxLayout;
|
||||
//
|
||||
// dialogWidget = new QWidget;
|
||||
// dialogWidget->setLayout(layout);
|
||||
//
|
||||
// //q->setLayout(layout);
|
||||
//
|
||||
// layout->addWidget(window);
|
||||
// layout->setAlignment(window, Qt::AlignCenter);
|
||||
//
|
||||
// window->setMinimumWidth(500);
|
||||
// window->setMinimumHeight(500);
|
||||
//
|
||||
// shadow->setWindow(window);
|
||||
//
|
||||
// //window->setAttribute(Qt::WA_DontShowOnScreen);
|
||||
//
|
||||
// //QSizePolicy sp = window->sizePolicy();
|
||||
// //sp.setRetainSizeWhenHidden(true);
|
||||
// //window->setSizePolicy(sp);
|
||||
//
|
||||
// //window->setHidden(true);
|
||||
//
|
||||
// //CustomShadowEffect *fx = new CustomShadowEffect;
|
||||
// //fx->setBlurRadius(8);
|
||||
// //fx->setColor(Qt::black);
|
||||
//
|
||||
// //window->setGraphicsEffect(fx);
|
||||
//
|
||||
// //QGraphicsOpacityEffect *opacity = new QGraphicsOpacityEffect;
|
||||
// //opacity->setOpacity(1);
|
||||
// //q->setGraphicsEffect(opacity);
|
||||
//
|
||||
// //QGraphicsBlurEffect *blur = new QGraphicsBlurEffect;
|
||||
// //blur->setBlurRadius(32);
|
||||
// //shadow->setGraphicsEffect(blur);
|
||||
//
|
||||
// QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||
// effect->setColor(QColor(0, 0, 0, 200));
|
||||
// effect->setBlurRadius(64);
|
||||
// effect->setOffset(0, 13);
|
||||
// window->setGraphicsEffect(effect);
|
||||
//
|
||||
// // QVBoxLayout *layout = new QVBoxLayout;
|
||||
// // window->setLayout(layout);
|
||||
//
|
||||
//// QPushButton *button = new QPushButton;
|
||||
//// button->setText("Hello test!");
|
||||
//// layout->addWidget(button);
|
||||
////
|
||||
//// button = new QPushButton;
|
||||
//// button->setText("Hello test!");
|
||||
//// layout->addWidget(button);
|
||||
////
|
||||
//// button = new QPushButton;
|
||||
//// button->setText("Hello test!");
|
||||
//// layout->addWidget(button);
|
||||
////
|
||||
//// button = new QPushButton;
|
||||
//// button->setText("Hello test!");
|
||||
//// layout->addWidget(button);
|
||||
////
|
||||
//// button = new QPushButton;
|
||||
//// button->setText("Hello test!");
|
||||
//// layout->addWidget(button);
|
||||
//
|
||||
// //window->setGeometry(0, 0, 500, 500);
|
||||
// window->setFixedSize(500, 500);
|
||||
//
|
||||
// */
|
||||
//}
|
||||
//
|
||||
//Dialog::Dialog(QWidget *parent)
|
||||
// : QWidget(parent),
|
||||
// d_ptr(new DialogPrivate(this))
|
||||
//{
|
||||
// d_func()->init();
|
||||
//}
|
||||
//
|
||||
//Dialog::~Dialog()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//void Dialog::pressOne()
|
||||
//{
|
||||
// Q_D(Dialog);
|
||||
//
|
||||
// d->layout->setCurrentIndex(0);
|
||||
//}
|
||||
//
|
||||
//void Dialog::pressTwo()
|
||||
//{
|
||||
// Q_D(Dialog);
|
||||
//
|
||||
// d->layout->setCurrentIndex(1);
|
||||
//}
|
||||
//
|
||||
////QWidget *Dialog::dialogWidget() const
|
||||
////{
|
||||
//// Q_D(const Dialog);
|
||||
////
|
||||
//// return d->dialogWidget;
|
||||
////}
|
||||
//
|
||||
///*
|
||||
//bool Dialog::event(QEvent *event)
|
||||
//{
|
||||
// Q_D(Dialog);
|
||||
//
|
||||
// switch (event->type())
|
||||
// {
|
||||
// case QEvent::ParentChange:
|
||||
// {
|
||||
// if (!parent())
|
||||
// break;
|
||||
//
|
||||
// parent()->installEventFilter(this);
|
||||
//
|
||||
// QWidget *widget;
|
||||
// if ((widget = parentWidget())) {
|
||||
// d->window->setParent(parentWidget());
|
||||
// setGeometry(widget->rect());
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// case QEvent::ParentAboutToChange:
|
||||
// {
|
||||
// if (!parent())
|
||||
// break;
|
||||
//
|
||||
// parent()->removeEventFilter(this);
|
||||
// break;
|
||||
// }
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
// return QWidget::event(event);
|
||||
//}
|
||||
//
|
||||
//bool Dialog::eventFilter(QObject *obj, QEvent *event)
|
||||
//{
|
||||
// QEvent::Type type = event->type();
|
||||
//
|
||||
// if (QEvent::Move == type || QEvent::Resize == type)
|
||||
// {
|
||||
// QWidget *widget;
|
||||
// if ((widget = parentWidget())) {
|
||||
// setGeometry(widget->rect());
|
||||
// }
|
||||
// }
|
||||
// return QWidget::eventFilter(obj, event);
|
||||
//}
|
||||
//*/
|
||||
//
|
||||
//void Dialog::paintEvent(QPaintEvent *event)
|
||||
//{
|
||||
// Q_UNUSED(event)
|
||||
//
|
||||
// QPainter painter(this);
|
||||
//
|
||||
// QBrush brush;
|
||||
// brush.setStyle(Qt::SolidPattern);
|
||||
// brush.setColor(Qt::black);
|
||||
// painter.setBrush(brush);
|
||||
// painter.setPen(Qt::NoPen);
|
||||
//
|
||||
// painter.setOpacity(0.5);
|
||||
//
|
||||
// painter.drawRect(rect());
|
||||
//
|
||||
// //QPainter painter(this);
|
||||
//
|
||||
// //QPen pen;
|
||||
// //pen.setWidth(12);
|
||||
// //painter.setPen(pen);
|
||||
//
|
||||
// //painter.drawRect(rect());
|
||||
//}
|
||||
//
|
||||
|
|
|
@ -33,22 +33,4 @@ private:
|
|||
Q_DECLARE_PRIVATE(Dialog)
|
||||
};
|
||||
|
||||
// //QWidget *dialogWidget() const;
|
||||
//
|
||||
//protected slots:
|
||||
// void pressOne();
|
||||
// void pressTwo();
|
||||
//
|
||||
//protected:
|
||||
//// bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||
//// bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
||||
// void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
//
|
||||
// const QScopedPointer<DialogPrivate> d_ptr;
|
||||
//
|
||||
//private:
|
||||
// Q_DISABLE_COPY(Dialog)
|
||||
// Q_DECLARE_PRIVATE(Dialog)
|
||||
//};
|
||||
|
||||
#endif // DIALOG_H
|
||||
|
|
|
@ -39,226 +39,3 @@ void DialogWindow::paintEvent(QPaintEvent *event)
|
|||
|
||||
painter.drawRect(rect());
|
||||
}
|
||||
|
||||
//DialogProxy::DialogProxy(Dialog *dialog, QWidget *widget)
|
||||
// : QWidget(dialog),
|
||||
// dialog(dialog),
|
||||
// widget(widget)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//DialogProxy::~DialogProxy()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//void DialogProxy::paintEvent(QPaintEvent *event)
|
||||
//{
|
||||
// Q_UNUSED(event)
|
||||
//
|
||||
// QPainter painter(this);
|
||||
//
|
||||
// //QPen pen;
|
||||
// //pen.setWidth(4);
|
||||
// //pen.setColor(Qt::red);
|
||||
// //painter.setPen(pen);
|
||||
//
|
||||
// //painter.drawRect(rect());
|
||||
//
|
||||
// //
|
||||
//
|
||||
// painter.setOpacity(0.3);
|
||||
//
|
||||
// QPixmap pm = widget->grab(rect());
|
||||
// painter.drawPixmap(rect(), pm);
|
||||
//
|
||||
//}
|
||||
//
|
||||
//DialogWindow::DialogWindow(Dialog *dialog)
|
||||
// : QWidget(dialog->parentWidget()),
|
||||
// dialog(dialog)
|
||||
//{
|
||||
// setContentsMargins(32, 32, 32, 32);
|
||||
//
|
||||
// qDebug() << dialog->parentWidget();
|
||||
//}
|
||||
//
|
||||
//DialogWindow::~DialogWindow()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//void DialogWindow::paintEvent(QPaintEvent *event)
|
||||
//{
|
||||
// Q_UNUSED(event)
|
||||
//
|
||||
// QPainter painter(this);
|
||||
//
|
||||
// QPen pen;
|
||||
// pen.setColor(Qt::red);
|
||||
// pen.setWidth(1);
|
||||
// painter.setPen(pen);
|
||||
// painter.drawRect(rect().adjusted(0, 0, -1, -1));
|
||||
//
|
||||
//// QLinearGradient tl(QPointF(0, 0), QPointF(32, 32));
|
||||
//// tl.setColorAt(0, QColor(0, 0, 0, 0));
|
||||
//// tl.setColorAt(1, QColor(0, 0, 0));
|
||||
//
|
||||
//// QColor shadow(0, 0, 0, 240);
|
||||
////
|
||||
//// QRadialGradient tl(rect().center(), 130);
|
||||
//// tl.setColorAt(0, shadow);
|
||||
//// tl.setColorAt(0.5, QColor(0, 0, 0));
|
||||
//// tl.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
////
|
||||
//// painter.setBrush(QBrush(tl));
|
||||
//// painter.setPen(Qt::NoPen);
|
||||
//// painter.drawRect(rect().adjusted(32, 32, -32, -32));
|
||||
//
|
||||
// /*
|
||||
// QColor shadow(0, 0, 0, 240);
|
||||
//
|
||||
// const int sz = 48;
|
||||
//
|
||||
// QLinearGradient top(QPointF(0, 0), QPointF(0, sz));
|
||||
// top.setColorAt(0, QColor(0, 0, 0, 0));
|
||||
// top.setColorAt(1, shadow);
|
||||
//
|
||||
// painter.setBrush(QBrush(top));
|
||||
// painter.setPen(Qt::NoPen);
|
||||
// painter.drawRect(sz, 0, width()-sz*2, sz);
|
||||
//
|
||||
// QLinearGradient left(QPointF(0, 0), QPointF(sz, 0));
|
||||
// left.setColorAt(0, QColor(0, 0, 0, 0));
|
||||
// left.setColorAt(1, shadow);
|
||||
//
|
||||
// painter.setBrush(QBrush(left));
|
||||
// painter.drawRect(0, sz, sz, height()-sz*2);
|
||||
//
|
||||
// QLinearGradient right(QPointF(width()-sz, 0), QPointF(width(), 0));
|
||||
// right.setColorAt(0, shadow);
|
||||
// right.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
//
|
||||
// painter.setBrush(QBrush(right));
|
||||
// painter.drawRect(width()-sz, sz, sz, height()-sz*2);
|
||||
//
|
||||
// QLinearGradient bottom(QPointF(0, height()-sz), QPointF(0, height()));
|
||||
// bottom.setColorAt(0, shadow);
|
||||
// bottom.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
//
|
||||
// painter.setBrush(QBrush(bottom));
|
||||
// painter.setPen(Qt::NoPen);
|
||||
// painter.drawRect(sz, height()-sz, width()-sz*2, sz);
|
||||
//
|
||||
// QRadialGradient tl(QPointF(sz, sz), sz);
|
||||
// tl.setColorAt(0, shadow);
|
||||
// tl.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
//
|
||||
// painter.setBrush(QBrush(tl));
|
||||
// painter.drawRect(0, 0, sz, sz);
|
||||
//
|
||||
// QRadialGradient tr(QPointF(width()-sz, sz), sz);
|
||||
// tr.setColorAt(0, shadow);
|
||||
// tr.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
//
|
||||
// painter.setBrush(QBrush(tr));
|
||||
// painter.drawRect(width()-sz, 0, sz, sz);
|
||||
//
|
||||
// QRadialGradient br(QPointF(width()-sz, height()-sz), sz);
|
||||
// br.setColorAt(0, shadow);
|
||||
// br.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
//
|
||||
// painter.setBrush(QBrush(br));
|
||||
// painter.drawRect(width()-sz, height()-sz, sz, sz);
|
||||
//
|
||||
// QRadialGradient bl(QPointF(sz, height()-sz), sz);
|
||||
// bl.setColorAt(0, shadow);
|
||||
// bl.setColorAt(1, QColor(0, 0, 0, 0));
|
||||
//
|
||||
// painter.setBrush(QBrush(bl));
|
||||
// painter.drawRect(0, height()-sz, sz, sz);
|
||||
// */
|
||||
//
|
||||
// //
|
||||
//
|
||||
// QBrush brush;
|
||||
// brush.setStyle(Qt::SolidPattern);
|
||||
// brush.setColor(Qt::white);
|
||||
// painter.setPen(Qt::NoPen);
|
||||
// //painter.setOpacity(0.5);
|
||||
// painter.setBrush(brush);
|
||||
//
|
||||
// //QRectF r(0, 0, 200, 200);
|
||||
// //r.moveCenter(rect().center());
|
||||
//
|
||||
// painter.drawRect(rect().adjusted(32, 32, -32, -32));
|
||||
//
|
||||
// {
|
||||
// QWidget *w = new QWidget;
|
||||
//
|
||||
// QVBoxLayout *layout = new QVBoxLayout;
|
||||
// w->setLayout(layout);
|
||||
//
|
||||
// QPushButton *button = new QPushButton;
|
||||
// button->setText("Hello test!");
|
||||
// layout->addWidget(button);
|
||||
//
|
||||
// //QPixmap pm = w->grab(rect().adjusted(0, 0, -64, -64));
|
||||
//
|
||||
// //QPixmap pm = dialog->dialogWidget()->grab(rect().adjusted(0, 0, -64, -64));
|
||||
//
|
||||
// //painter.drawPixmap(rect().adjusted(32, 32, -32, -32), pm);
|
||||
//
|
||||
// painter.drawRect(rect());
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //brush.setColor(Qt::black);
|
||||
// //painter.setBrush(brush);
|
||||
// //painter.setOpacity(0.8);
|
||||
//
|
||||
// //painter.drawRect(rect().adjusted(32, 32, -32, -32));
|
||||
//}
|
||||
//
|
||||
//DialogShadow::DialogShadow(QWidget *dialog)
|
||||
// : QWidget(dialog)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//DialogShadow::~DialogShadow()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//void DialogShadow::setWindow(DialogWindow *window)
|
||||
//{
|
||||
// this->window = window;
|
||||
// window->installEventFilter(this);
|
||||
//}
|
||||
//
|
||||
//void DialogShadow::paintEvent(QPaintEvent *event)
|
||||
//{
|
||||
// Q_UNUSED(event)
|
||||
//
|
||||
// QPainter painter(this);
|
||||
//
|
||||
//// QBrush brush;
|
||||
//// brush.setStyle(Qt::SolidPattern);
|
||||
//// brush.setColor(Qt::black);
|
||||
//// painter.setBrush(brush);
|
||||
//// painter.setOpacity(1);
|
||||
////
|
||||
//// painter.drawRect(rect());
|
||||
//}
|
||||
//
|
||||
//bool DialogShadow::eventFilter(QObject *obj, QEvent *event)
|
||||
//{
|
||||
// QEvent::Type type = event->type();
|
||||
//
|
||||
// if (QEvent::Move == type || QEvent::Resize == type)
|
||||
// {
|
||||
// QWidget *widget;
|
||||
// if ((widget = static_cast<QWidget *>(obj))) {
|
||||
// setGeometry(widget->geometry());
|
||||
// }
|
||||
// }
|
||||
// return QWidget::eventFilter(obj, event);
|
||||
//}
|
||||
//
|
||||
|
|
|
@ -32,65 +32,4 @@ private:
|
|||
Dialog *const dialog;
|
||||
};
|
||||
|
||||
//#include <QWidget>
|
||||
//
|
||||
//class Dialog;
|
||||
//
|
||||
//class DialogProxy : public QWidget
|
||||
//{
|
||||
// Q_OBJECT
|
||||
//
|
||||
//public:
|
||||
// DialogProxy(Dialog *dialog, QWidget *widget);
|
||||
// ~DialogProxy();
|
||||
//
|
||||
//protected:
|
||||
// void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
//
|
||||
//private:
|
||||
// Q_DISABLE_COPY(DialogProxy)
|
||||
//
|
||||
// Dialog *const dialog;
|
||||
// QWidget *widget;
|
||||
//};
|
||||
//
|
||||
///* -- */
|
||||
//
|
||||
//class DialogWindow : public QWidget
|
||||
//{
|
||||
// Q_OBJECT
|
||||
//
|
||||
//public:
|
||||
// DialogWindow(Dialog *dialog);
|
||||
// ~DialogWindow();
|
||||
//
|
||||
//protected:
|
||||
// void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
//
|
||||
//private:
|
||||
// Q_DISABLE_COPY(DialogWindow)
|
||||
//
|
||||
// Dialog *const dialog;
|
||||
//};
|
||||
//
|
||||
//class DialogShadow : public QWidget
|
||||
//{
|
||||
// Q_OBJECT
|
||||
//
|
||||
//public:
|
||||
// DialogShadow(QWidget *dialog);
|
||||
// ~DialogShadow();
|
||||
//
|
||||
// void setWindow(DialogWindow *window);
|
||||
//
|
||||
//protected:
|
||||
// void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||
// bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
|
||||
//
|
||||
//private:
|
||||
// Q_DISABLE_COPY(DialogShadow)
|
||||
//
|
||||
// DialogWindow *window;
|
||||
//};
|
||||
|
||||
#endif // DIALOG_INTERNAL_H
|
||||
|
|
|
@ -34,6 +34,8 @@ void FloatingActionButtonPrivate::init()
|
|||
if (q->parentWidget()) {
|
||||
q->parentWidget()->installEventFilter(q);
|
||||
}
|
||||
|
||||
q->setFixedRippleRadius(50);
|
||||
}
|
||||
|
||||
QRect FloatingActionButtonPrivate::fabGeometry() const
|
||||
|
@ -128,6 +130,8 @@ void FloatingActionButton::setMini(bool state)
|
|||
path.addEllipse(0, 0, s, s);
|
||||
d->ripple->setClipPath(path);
|
||||
|
||||
setFixedRippleRadius(state ? 30 : 50);
|
||||
|
||||
d->assignAnimationProperties();
|
||||
update();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@ FlatButtonPrivate::FlatButtonPrivate(FlatButton *q)
|
|||
bgMode(Qt::TransparentMode),
|
||||
useThemeColors(true),
|
||||
showHalo(true),
|
||||
peakOpacity(0.08)
|
||||
peakOpacity(0.08),
|
||||
useFixedRippleRadius(false),
|
||||
fixedRippleRadius(64)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -67,6 +69,28 @@ FlatButton::~FlatButton()
|
|||
{
|
||||
}
|
||||
|
||||
void FlatButton::setHasFixedRippleRadius(bool value)
|
||||
{
|
||||
Q_D(FlatButton);
|
||||
|
||||
d->useFixedRippleRadius = value;
|
||||
}
|
||||
|
||||
bool FlatButton::hasFixedRippleRadius() const
|
||||
{
|
||||
Q_D(const FlatButton);
|
||||
|
||||
return d->useFixedRippleRadius;
|
||||
}
|
||||
|
||||
void FlatButton::setFixedRippleRadius(qreal radius)
|
||||
{
|
||||
Q_D(FlatButton);
|
||||
|
||||
d->fixedRippleRadius = radius;
|
||||
setHasFixedRippleRadius(true);
|
||||
}
|
||||
|
||||
void FlatButton::setRippleStyle(Material::RippleStyle style)
|
||||
{
|
||||
Q_D(FlatButton);
|
||||
|
@ -339,6 +363,10 @@ void FlatButton::mousePressEvent(QMouseEvent *event)
|
|||
ripple->setColor(palette().color(QPalette::Active, QPalette::ButtonText));
|
||||
ripple->setDuration(600, 1300);
|
||||
|
||||
if (d->useFixedRippleRadius) {
|
||||
ripple->setRadiusEndValue(d->fixedRippleRadius);
|
||||
}
|
||||
|
||||
d->ripple->addRipple(ripple);
|
||||
|
||||
QPushButton::mousePressEvent(event);
|
||||
|
|
|
@ -31,6 +31,11 @@ public:
|
|||
explicit FlatButton(const QString &text, QWidget *parent = 0);
|
||||
~FlatButton();
|
||||
|
||||
void setHasFixedRippleRadius(bool value);
|
||||
bool hasFixedRippleRadius() const;
|
||||
|
||||
void setFixedRippleRadius(qreal radius);
|
||||
|
||||
void setRole(Material::Role role);
|
||||
Material::Role role() const;
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
bool useThemeColors;
|
||||
bool showHalo;
|
||||
qreal peakOpacity;
|
||||
bool useFixedRippleRadius;
|
||||
qreal fixedRippleRadius;
|
||||
};
|
||||
|
||||
#endif // FLATBUTTON_P_H
|
||||
|
|
Loading…
Reference in New Issue