MCPcopy Create free account
hub / github.com/KDAB/GammaRay / drawDecoration

Method drawDecoration

plugins/widgetinspector/widgetremoteview.cpp:49–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void WidgetRemoteView::drawDecoration(QPainter *p)
50{
51 if (!m_tabFocusEnabled)
52 return;
53
54 const auto data = frame().data.value<WidgetFrameData>();
55 if (data.tabFocusRects.size() < 2)
56 return;
57
58 p->save();
59 p->setPen(Qt::darkGreen);
60 for (const auto &rect : data.tabFocusRects)
61 p->drawRect(mapFromSource(rect));
62
63 QVector<QLineF> lines;
64 lines.reserve(data.tabFocusRects.size());
65 for (int i = 0; i < data.tabFocusRects.size() - 1; ++i) {
66 const auto r1 = mapFromSource(data.tabFocusRects.at(i));
67 const auto r2 = mapFromSource(data.tabFocusRects.at(i + 1));
68
69 p->setPen(Qt::green);
70 QLineF l(r1.center(), r2.center());
71 for (const auto &prevLine : std::as_const(lines)) {
72 QPointF pnt;
73 if (l.intersects(prevLine, &pnt) == QLineF::BoundedIntersection && pnt != l.p1() && pnt != l.p2()) {
74 p->setPen(Qt::red);
75 break;
76 }
77 }
78 lines.push_back(l);
79 drawArrow(p, r1.center(), r2.center());
80 }
81 p->restore();
82}

Callers

nothing calls this directly

Calls 5

drawArrowFunction · 0.85
saveMethod · 0.80
reserveMethod · 0.80
centerMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected