| 126 | } |
| 127 | |
| 128 | void 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 | |
| 159 | void Cursor::compute_text_size(QPainter &p, unsigned int prefix) |
| 160 | { |
no test coverage detected