MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / paint

Method paint

examples/DCPS/ishapes/Triangle.cpp:51–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51void
52Triangle::paint(QPainter& painter) {
53 painter.setBrush(brush_);
54 painter.setPen(pen_);
55
56 std::vector<QPoint> plist = dynamics_->getPositionList();
57 std::vector<QPoint>::iterator idx = plist.begin();
58
59 QBrush black( QColor(0x33, 0x33, 0x33), Qt::SolidPattern);
60 QBrush white( QColor(0xFF, 0xFF, 0xFF), Qt::SolidPattern);
61 QBrush brush;
62
63 while (idx != plist.end()) {
64 painter.translate(idx->x() - bounds_.width()/2,
65 idx->y() - bounds_.height()/2);
66 painter.drawPolygon(triangle_);
67 painter.translate(-(idx->x() - bounds_.width()/2),
68 -(idx->y() - bounds_.height()/2));
69
70 if (targeted_)
71 brush = black;
72 else
73 brush = white;
74
75 painter.setBrush(brush);
76 int X0 = idx->x();
77 int Y0 = idx->y() + (bounds_.height()/6);
78 int W = bounds_.width()/3;
79 int H = bounds_.height()/3;
80 painter.setBrush(brush);
81 painter.drawEllipse(X0 - W/2,
82 Y0 - H/2,
83 W,
84 H);
85 painter.setBrush(brush_);
86 painter.setBrush(brush_);
87
88 ++idx;
89 }
90}

Callers

nothing calls this directly

Calls 6

setBrushMethod · 0.80
setPenMethod · 0.80
getPositionListMethod · 0.80
widthMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected