#include <QGraphicsItem>
#include <QPainter>
#include <QPainterPath>
{
public:
ConfirmationScene();
~ConfirmationScene();
};
#include <QGraphicsItem>
#include <QPainter>
#include <QPainterPath>
class ConfirmationScene:public QGraphicsItem
{
public:
QRectF r1;
QPainterPath path;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
QRectF boundingRect() const;
ConfirmationScene();
~ConfirmationScene();
};
To copy to clipboard, switch view to plain text mode
#include "ConfirmationScene.h"
ConfirmationScene::ConfirmationScene()
{
r1.setRect(10,10,50,50);
path.addEllipse(r1);
}
{
painter
->setPen
(QPen(QBrush(Qt
::gray,Qt
::SolidPattern),
30,Qt
::SolidLine,Qt
::FlatCap,Qt
::MiterJoin));
painter->drawEllipse(0, 0, 200, 200);
painter
->fillPath
(path,
QBrush(Qt
::green,Qt
::SolidPattern));
painter->drawPath(path);
}
QRectF ConfirmationScene
::boundingRect() const {
qreal penWidth = 150;
return QRectF(-10 - penWidth
/ 2,
-10 - penWidth
/ 2,
20 + penWidth
/ 2,
20 + penWidth
/ 2);
}
ConfirmationScene::~ConfirmationScene()
{
}
#include "ConfirmationScene.h"
ConfirmationScene::ConfirmationScene()
{
r1.setRect(10,10,50,50);
path.addEllipse(r1);
}
void ConfirmationScene::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
painter->setPen(QPen(QBrush(Qt::gray,Qt::SolidPattern),30,Qt::SolidLine,Qt::FlatCap,Qt::MiterJoin));
painter->drawEllipse(0, 0, 200, 200);
painter->fillPath(path,QBrush(Qt::green,Qt::SolidPattern));
painter->drawPath(path);
}
QRectF ConfirmationScene::boundingRect() const
{
qreal penWidth = 150;
return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,20 + penWidth / 2, 20 + penWidth / 2);
}
ConfirmationScene::~ConfirmationScene()
{
}
To copy to clipboard, switch view to plain text mode
Bookmarks