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

Method paint

examples/DCPS/ishapes/Square.cpp:19–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void
20Square::paint(QPainter& painter) {
21
22 painter.setBrush(brush_);
23 painter.setPen(pen_);
24
25 std::vector<QPoint> plist = dynamics_->getPositionList();
26 std::vector<QPoint>::iterator idx = plist.begin();
27 QBrush black( QColor(0x33, 0x33, 0x33), Qt::SolidPattern);
28 QBrush white( QColor(0xFF, 0xFF, 0xFF), Qt::SolidPattern);
29 QBrush brush;
30
31 while (idx != plist.end()) {
32 painter.drawRect(idx->x() - bounds_.width()/2,
33 idx->y() - bounds_.height()/2,
34 bounds_.width(),
35 bounds_.height());
36 if (targeted_)
37 brush = black;
38 else
39 brush = white;
40
41 painter.setBrush(brush);
42 int X0 = idx->x();
43 int Y0 = idx->y();
44 int W = bounds_.width()/3;
45 int H = bounds_.height()/3;
46 painter.setBrush(brush);
47 painter.drawRect(X0 - W/2,
48 Y0 - H/2,
49 W,
50 H);
51 painter.setBrush(brush_);
52
53 ++idx;
54 }
55}
56
57Square::~Square() {
58}

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