| 80 | } |
| 81 | |
| 82 | void Cursor::paint_label(QPainter &p, const QRect &rect, |
| 83 | unsigned int prefix, bool has_hoff) |
| 84 | { |
| 85 | using pv::view::Ruler; |
| 86 | bool visible; |
| 87 | |
| 88 | compute_text_size(p, prefix); |
| 89 | const QRect r(get_label_rect(rect, visible, has_hoff)); |
| 90 | if (!visible) |
| 91 | return; |
| 92 | const QRect close(get_close_rect(r)); |
| 93 | |
| 94 | p.setPen(Qt::transparent); |
| 95 | |
| 96 | if (close.contains(QPoint(_view.hover_point().x(), _view.hover_point().y()))) |
| 97 | p.setBrush(Ruler::GetColorByCursorOrder(_order)); |
| 98 | else if (r.contains(QPoint(_view.hover_point().x(), _view.hover_point().y()))) |
| 99 | p.setBrush(View::Orange); |
| 100 | else |
| 101 | p.setBrush(Ruler::GetColorByCursorOrder(_order)); |
| 102 | |
| 103 | p.drawRect(r); |
| 104 | |
| 105 | const QPoint points[] = { |
| 106 | QPoint(r.left() + r.width() / 2 - ArrowSize, r.bottom()), |
| 107 | QPoint(r.left() + r.width() / 2 + ArrowSize, r.bottom()), |
| 108 | QPoint(r.left() + r.width() / 2, rect.bottom()), |
| 109 | }; |
| 110 | p.drawPolygon(points, countof(points)); |
| 111 | |
| 112 | if (close.contains(QPoint(_view.hover_point().x(), _view.hover_point().y()))) |
| 113 | p.setBrush(View::Red); |
| 114 | else |
| 115 | p.setBrush(View::Orange); |
| 116 | p.drawRect(close); |
| 117 | p.setPen(Qt::black); |
| 118 | p.drawLine(close.left() + 2, close.top() + 2, close.right() - 2, close.bottom() - 2); |
| 119 | p.drawLine(close.left() + 2, close.bottom() - 2, close.right() - 2, close.top() + 2); |
| 120 | |
| 121 | p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, |
| 122 | Ruler::format_real_time(_index, _view.session().cur_snap_samplerate())); |
| 123 | |
| 124 | const QRect arrowRect = QRect(r.bottomLeft().x(), r.bottomLeft().y(), r.width(), ArrowSize); |
| 125 | p.drawText(arrowRect, Qt::AlignCenter | Qt::AlignVCenter, QString::number(_order)); |
| 126 | } |
| 127 | |
| 128 | void Cursor::paint_fix_label(QPainter &p, const QRect &rect, |
| 129 | unsigned int prefix, QChar label, QColor color, bool has_hoff) |
nothing calls this directly
no test coverage detected