make Radio Button pimpl class
This commit is contained in:
parent
798aeea5f7
commit
07ce6b642f
|
@ -1,8 +1,20 @@
|
||||||
#include <QPainter>
|
|
||||||
#include "radiobutton.h"
|
#include "radiobutton.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include "radiobutton_p.h"
|
||||||
|
|
||||||
|
RadioButtonPrivate::RadioButtonPrivate(RadioButton *q)
|
||||||
|
: q_ptr(q)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioButtonPrivate::init()
|
||||||
|
{
|
||||||
|
//Q_Q(RadioButton);
|
||||||
|
}
|
||||||
|
|
||||||
RadioButton::RadioButton(QWidget *parent)
|
RadioButton::RadioButton(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QRadioButton(parent),
|
||||||
|
d_ptr(new RadioButtonPrivate(this))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#ifndef RADIOBUTTON_H
|
#ifndef RADIOBUTTON_H
|
||||||
#define RADIOBUTTON_H
|
#define RADIOBUTTON_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QRadioButton>
|
||||||
|
|
||||||
class RadioButton : public QWidget
|
class RadioButtonPrivate;
|
||||||
|
|
||||||
|
class RadioButton : public QRadioButton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -15,6 +17,12 @@ protected:
|
||||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||||
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
const QScopedPointer<RadioButtonPrivate> d_ptr;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(RadioButton)
|
||||||
|
Q_DECLARE_PRIVATE(RadioButton)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RADIOBUTTON_H
|
#endif // RADIOBUTTON_H
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef RADIOBUTTON_P_H
|
||||||
|
#define RADIOBUTTON_P_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class RadioButton;
|
||||||
|
class RippleOverlay;
|
||||||
|
|
||||||
|
class RadioButtonPrivate
|
||||||
|
{
|
||||||
|
Q_DISABLE_COPY(RadioButtonPrivate)
|
||||||
|
Q_DECLARE_PUBLIC(RadioButton)
|
||||||
|
|
||||||
|
public:
|
||||||
|
RadioButtonPrivate(RadioButton *q);
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
|
RadioButton *const q_ptr;
|
||||||
|
RippleOverlay *ripple;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RADIOBUTTON_P_H
|
|
@ -120,7 +120,8 @@ HEADERS += mainwindow.h \
|
||||||
components/badge.h \
|
components/badge.h \
|
||||||
components/progress.h \
|
components/progress.h \
|
||||||
components/selectfield.h \
|
components/selectfield.h \
|
||||||
components/fab_p.h
|
components/fab_p.h \
|
||||||
|
components/radiobutton_p.h
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc
|
resources.qrc
|
||||||
|
|
Loading…
Reference in New Issue