MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / paint_fix_label

Method paint_fix_label

DSView/pv/view/cursor.cpp:128–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128void Cursor::paint_fix_label(QPainter &p, const QRect &rect,
129 unsigned int prefix, QChar label, QColor color, bool has_hoff)
130{
131 using pv::view::Ruler;
132 bool visible;
133
134 compute_text_size(p, prefix);
135 const QRect r(get_label_rect(rect, visible, has_hoff));
136 if (!visible)
137 return;
138
139 p.setPen(Qt::transparent);
140 p.setBrush(color);
141 p.drawRect(r);
142
143 const QPoint points[] = {
144 QPoint(r.left() + r.width() / 2 - ArrowSize, r.bottom()),
145 QPoint(r.left() + r.width() / 2 + ArrowSize, r.bottom()),
146 QPoint(r.left() + r.width() / 2, rect.bottom()),
147 };
148 p.drawPolygon(points, countof(points));
149
150 p.setPen(Qt::white);
151 if (has_hoff)
152 p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter,
153 Ruler::format_real_time(_index, _view.session().cur_snap_samplerate()));
154
155 const QRect arrowRect = QRect(r.bottomLeft().x(), r.bottomLeft().y(), r.width(), ArrowSize);
156 p.drawText(arrowRect, Qt::AlignCenter | Qt::AlignVCenter, label);
157}
158
159void Cursor::compute_text_size(QPainter &p, unsigned int prefix)
160{

Callers 2

draw_logic_tick_markMethod · 0.80
draw_osc_tick_markMethod · 0.80

Calls 3

cur_snap_samplerateMethod · 0.80
sessionMethod · 0.80
QRectClass · 0.70

Tested by

no test coverage detected