MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / paint_label

Method paint_label

DSView/pv/view/xcursor.cpp:245–270  ·  view source on GitHub ↗

* Paints the labels to the xcursor. * @param p The painter to draw with. * @param rect The rectangle of the xcursor area. */

Source from the content-addressed store, hash-verified

243 * @param rect The rectangle of the xcursor area.
244 */
245void XCursor::paint_label(QPainter &p, const QRect &rect)
246{
247 if (_dsoSig) {
248 QRect map_rect = get_map_rect(rect);
249 p.setPen(Qt::NoPen);
250 p.setBrush(_dsoSig->get_colour());
251 p.drawRect(map_rect);
252 p.setPen(Qt::white);
253 p.drawText(map_rect, Qt::AlignCenter | Qt::AlignHCenter, QString::number(_dsoSig->get_index()));
254 }
255
256 QRect close = get_close_rect(rect);
257 p.setPen(Qt::NoPen);
258
259 if (close.contains(QPoint(_view.hover_point().x(), _view.hover_point().y())))
260 p.setBrush(View::Red);
261 else if (_dsoSig != NULL)
262 p.setBrush(_dsoSig->get_colour());
263 else
264 p.setBrush(View::Blue);
265
266 p.drawRect(close);
267 p.setPen(Qt::black);
268 p.drawLine(close.left() + 2, close.top() + 2, close.right() - 2, close.bottom() - 2);
269 p.drawLine(close.left() + 2, close.bottom() - 2, close.right() - 2, close.top() + 2);
270}
271
272QColor XCursor::get_color()
273{

Callers

nothing calls this directly

Calls 2

get_colourMethod · 0.80
get_indexMethod · 0.45

Tested by

no test coverage detected