-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsvgitem.cpp
More file actions
64 lines (50 loc) · 1.68 KB
/
svgitem.cpp
File metadata and controls
64 lines (50 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "svgitem.h"
SvgItem::SvgItem(QGraphicsItem *parent) :
QGraphicsRectItem(parent)
{
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
void SvgItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
painter->setRenderHint( QPainter::Antialiasing );
QPen pen(Qt::black, 0.15, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
pen.setWidthF(0.5);
painter->setPen(pen);
// foreach(QBezier *qbezier, qBezierList)
// {
// //qDebug() << qbezier->getPolygon();
// painter->drawPolyline(qbezier->getPolygon());
// }
foreach(BasicPolygon *poly, polyList)
{
//qDebug() << qbezier->getPolygon();
painter->drawPolyline(poly->getPolygon());
}
// foreach(Arc *arc, arcList)
// {
// //qDebug() << qbezier->getPolygon();
// painter->drawPolyline(arc->getPolygon());
// }
// foreach(BasicPolygon* poly, polygons)
// {
// painter->drawPolyline( poly->getPolygon() );
// }
foreach(Line* line, lineList)
{
pen.setWidthF( line->getWidth() );
painter->setPen(pen);
painter->drawLine(line->p1(), line->p2());
}
pen.setWidthF(0.25);
painter->setPen(pen);
foreach(Circle* circle, circleList)
{
/*QBrush brush = painter->brush();
brush.setStyle(Qt::SolidPattern);
painter->setBrush(brush);
painter->drawEllipse(circle->center(), circle->height(), circle->width());*/
painter->drawPolyline(circle->getPolygon());
}
//QGraphicsRectItem::paint(painter, option, widget);
}