add boilerplate code to Progress

This commit is contained in:
laserpants 2016-06-18 12:12:20 +03:00
parent 75af97d4d3
commit 3cd3953629
5 changed files with 48 additions and 4 deletions

View File

@ -0,0 +1 @@
#include "circularprogress.h"

View File

@ -1,8 +1,24 @@
#include "progress.h" #include "progress.h"
#include "progress_p.h"
ProgressPrivate::ProgressPrivate(Progress *q)
: q_ptr(q)
{
}
ProgressPrivate::~ProgressPrivate()
{
}
void ProgressPrivate::init()
{
}
Progress::Progress(QWidget *parent) Progress::Progress(QWidget *parent)
: QWidget(parent) : QWidget(parent),
d_ptr(new ProgressPrivate(this))
{ {
d_func()->init();
} }
Progress::~Progress() Progress::~Progress()

View File

@ -3,6 +3,8 @@
#include <QWidget> #include <QWidget>
class ProgressPrivate;
class Progress : public QWidget class Progress : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -11,9 +13,12 @@ public:
explicit Progress(QWidget *parent = 0); explicit Progress(QWidget *parent = 0);
~Progress(); ~Progress();
protected:
const QScopedPointer<ProgressPrivate> d_ptr;
private: private:
Q_DISABLE_COPY(Progress) Q_DISABLE_COPY(Progress)
//Q_DECLARE_PRIVATE(Progress) Q_DECLARE_PRIVATE(Progress)
}; };
#endif // PROGRESS_H #endif // PROGRESS_H

View File

@ -1,4 +1,22 @@
#ifndef PROGRESS_P_H #ifndef PROGRESS_P_H
#define PROGRESS_P_H #define PROGRESS_P_H
#include <QObject>
class Progress;
class ProgressPrivate
{
Q_DISABLE_COPY(ProgressPrivate)
Q_DECLARE_PUBLIC(Progress)
public:
ProgressPrivate(Progress *q);
~ProgressPrivate();
void init();
Progress *const q_ptr;
};
#endif // PROGRESS_P_H #endif // PROGRESS_P_H

View File

@ -65,7 +65,8 @@ SOURCES += main.cpp\
components/snackbar.cpp \ components/snackbar.cpp \
components/textfield_internal.cpp \ components/textfield_internal.cpp \
components/drawer.cpp \ components/drawer.cpp \
components/snackbar_internal.cpp components/snackbar_internal.cpp \
components/circularprogress.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
components/appbar.h \ components/appbar.h \
@ -139,7 +140,10 @@ HEADERS += mainwindow.h \
components/badge_p.h \ components/badge_p.h \
components/drawer.h \ components/drawer.h \
components/avatar_p.h \ components/avatar_p.h \
components/snackbar_internal.h components/snackbar_internal.h \
components/progress_p.h \
components/circularprogress.h \
components/circularprogress_p.h
RESOURCES += \ RESOURCES += \
resources.qrc resources.qrc