implement paint event handler
This commit is contained in:
parent
05ccb702e6
commit
8aef67d661
|
@ -1,4 +1,5 @@
|
||||||
#include "circularprogress.h"
|
#include "circularprogress.h"
|
||||||
|
#include <QPainter>
|
||||||
#include "circularprogress_p.h"
|
#include "circularprogress_p.h"
|
||||||
|
|
||||||
CircularProgressPrivate::CircularProgressPrivate(CircularProgress *q)
|
CircularProgressPrivate::CircularProgressPrivate(CircularProgress *q)
|
||||||
|
@ -24,3 +25,10 @@ CircularProgress::CircularProgress(QWidget *parent)
|
||||||
CircularProgress::~CircularProgress()
|
CircularProgress::~CircularProgress()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CircularProgress::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
QPainter painter(this);
|
||||||
|
|
||||||
|
painter.drawRect(rect());
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ public:
|
||||||
~CircularProgress();
|
~CircularProgress();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
const QScopedPointer<CircularProgressPrivate> d_ptr;
|
const QScopedPointer<CircularProgressPrivate> d_ptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "progress.h"
|
#include "progress.h"
|
||||||
|
#include <QPainter>
|
||||||
#include "progress_p.h"
|
#include "progress_p.h"
|
||||||
|
|
||||||
ProgressPrivate::ProgressPrivate(Progress *q)
|
ProgressPrivate::ProgressPrivate(Progress *q)
|
||||||
|
@ -24,3 +25,10 @@ Progress::Progress(QWidget *parent)
|
||||||
Progress::~Progress()
|
Progress::~Progress()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Progress::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
QPainter painter(this);
|
||||||
|
|
||||||
|
painter.drawRect(rect());
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ public:
|
||||||
~Progress();
|
~Progress();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
const QScopedPointer<ProgressPrivate> d_ptr;
|
const QScopedPointer<ProgressPrivate> d_ptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "appbarexamples.h"
|
#include "appbarexamples.h"
|
||||||
#include "components/appbar.h"
|
#include "components/appbar.h"
|
||||||
#include "frame.h"
|
#include "frame.h"
|
||||||
|
#include "components/progress.h"
|
||||||
|
|
||||||
AppBarExamples::AppBarExamples(QWidget *parent)
|
AppBarExamples::AppBarExamples(QWidget *parent)
|
||||||
: ExampleList(parent)
|
: ExampleList(parent)
|
||||||
|
@ -34,6 +35,22 @@ AppBarExamples::AppBarExamples(QWidget *parent)
|
||||||
);
|
);
|
||||||
frame->setWidget(area);
|
frame->setWidget(area);
|
||||||
|
|
||||||
|
mainLayout->addWidget(frame);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
QWidget *widget = new QWidget;
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
|
|
||||||
|
widget->setLayout(layout);
|
||||||
|
|
||||||
|
Progress *p = new Progress;
|
||||||
|
|
||||||
|
Frame *frame = new Frame;
|
||||||
|
frame->setCodeSnippet(
|
||||||
|
""
|
||||||
|
);
|
||||||
|
frame->setWidget(p);
|
||||||
|
|
||||||
mainLayout->addWidget(frame);
|
mainLayout->addWidget(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue