re-implement Raised Button as pimpl class
This commit is contained in:
parent
5de589a271
commit
c2cc1af580
|
@ -1,9 +1,26 @@
|
|||
#include "raisedbutton.h"
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
#include "raisedbutton_p.h"
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
RaisedButton::RaisedButton(QWidget *parent)
|
||||
: FlatButton(*new RaisedButtonPrivate(this), parent)
|
||||
{
|
||||
Q_D(RaisedButton);
|
||||
|
||||
d->init();
|
||||
}
|
||||
|
||||
RaisedButton::~RaisedButton()
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include "flatbutton.h"
|
||||
|
||||
class RaisedButtonPrivate;
|
||||
|
||||
class RaisedButton : public FlatButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -10,6 +12,10 @@ class RaisedButton : public FlatButton
|
|||
public:
|
||||
explicit RaisedButton(QWidget *parent = 0);
|
||||
~RaisedButton();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RaisedButton)
|
||||
Q_DECLARE_PRIVATE(RaisedButton)
|
||||
};
|
||||
|
||||
#endif // RAISEDBUTTON_H
|
||||
|
|
|
@ -11,8 +11,9 @@ class RaisedButtonPrivate : public FlatButtonPrivate
|
|||
public:
|
||||
RaisedButtonPrivate(RaisedButton *q)
|
||||
: FlatButtonPrivate(q)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif // RAISEDBUTTON_P_H
|
||||
|
|
Loading…
Reference in New Issue