2016-03-22 08:50:48 +00:00
|
|
|
#include "raisedbutton.h"
|
2016-05-17 13:43:46 +00:00
|
|
|
#include <QGraphicsDropShadowEffect>
|
2016-05-17 12:26:50 +00:00
|
|
|
#include "raisedbutton_p.h"
|
|
|
|
|
2016-05-17 13:43:46 +00:00
|
|
|
void RaisedButtonPrivate::init()
|
|
|
|
{
|
|
|
|
Q_Q(RaisedButton);
|
|
|
|
|
|
|
|
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
|
|
|
effect->setBlurRadius(7);
|
|
|
|
effect->setOffset(QPoint(0, 0));
|
|
|
|
effect->setColor(QColor(0, 0, 0, 100));
|
|
|
|
q->setGraphicsEffect(effect);
|
|
|
|
|
|
|
|
q->setAutoFillBackground(true);
|
|
|
|
}
|
|
|
|
|
2016-03-22 08:50:48 +00:00
|
|
|
RaisedButton::RaisedButton(QWidget *parent)
|
2016-05-17 12:26:50 +00:00
|
|
|
: FlatButton(*new RaisedButtonPrivate(this), parent)
|
2016-03-22 08:50:48 +00:00
|
|
|
{
|
2016-05-17 13:43:46 +00:00
|
|
|
Q_D(RaisedButton);
|
|
|
|
|
|
|
|
d->init();
|
2016-03-22 08:50:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RaisedButton::~RaisedButton()
|
|
|
|
{
|
|
|
|
}
|
2016-03-22 09:48:59 +00:00
|
|
|
|
2016-05-17 12:26:50 +00:00
|
|
|
//#include <QDebug>
|
|
|
|
//#include <QPropertyAnimation>
|
|
|
|
//#include <QGraphicsDropShadowEffect>
|
|
|
|
//#include <QStylePainter>
|
|
|
|
//#include <QPaintEvent>
|
|
|
|
//#include "raisedbutton.h"
|
|
|
|
//
|
|
|
|
//RaisedButton::RaisedButton(QWidget *parent)
|
|
|
|
// : FlatButton(parent)
|
|
|
|
//{
|
|
|
|
// QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
|
|
|
// effect->setBlurRadius(7);
|
|
|
|
// effect->setOffset(QPoint(0, 0));
|
|
|
|
// effect->setColor(QColor(0, 0, 0, 100));
|
|
|
|
// setGraphicsEffect(effect);
|
|
|
|
//
|
|
|
|
// setAutoFillBackground(true);
|
|
|
|
//
|
|
|
|
// QPropertyAnimation *animation;
|
|
|
|
//
|
|
|
|
// animation = new QPropertyAnimation;
|
|
|
|
// animation->setTargetObject(effect);
|
|
|
|
// animation->setPropertyName("offset");
|
|
|
|
// animation->setStartValue(QPoint(0, 6));
|
|
|
|
// animation->setEndValue(QPoint(0, 0));
|
|
|
|
// animation->setDuration(100);
|
|
|
|
// _group.addAnimation(animation);
|
|
|
|
//
|
|
|
|
// animation = new QPropertyAnimation;
|
|
|
|
// animation->setTargetObject(effect);
|
|
|
|
// animation->setPropertyName("blurRadius");
|
|
|
|
// animation->setStartValue(20);
|
|
|
|
// animation->setEndValue(7);
|
|
|
|
// animation->setDuration(100);
|
|
|
|
// _group.addAnimation(animation);
|
|
|
|
//
|
|
|
|
// connect(animation, SIGNAL(valueChanged(QVariant)), this, SLOT(update()));
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//RaisedButton::~RaisedButton()
|
|
|
|
//{
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void RaisedButton::mousePressEvent(QMouseEvent *event)
|
|
|
|
//{
|
|
|
|
// _group.setDirection(QAbstractAnimation::Backward);
|
|
|
|
// _group.start();
|
|
|
|
//
|
|
|
|
// FlatButton::mousePressEvent(event);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void RaisedButton::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
//{
|
|
|
|
// _group.setDirection(QAbstractAnimation::Forward);
|
|
|
|
// _group.start();
|
|
|
|
//
|
|
|
|
// FlatButton::mouseReleaseEvent(event);
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//void RaisedButton::paintEvent(QPaintEvent *event)
|
|
|
|
//{
|
|
|
|
// Q_UNUSED(event)
|
|
|
|
//
|
|
|
|
// QStylePainter painter(this);
|
|
|
|
//
|
|
|
|
//// painter.drawControl(QStyle::CE_PushButton, getStyleOption());
|
|
|
|
//}
|
|
|
|
//
|