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

Method get_label_rect

DSView/pv/view/cursor.cpp:55–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55QRect Cursor::get_label_rect(const QRect &rect, bool &visible, bool has_hoff)
56{
57 const double samples_per_pixel = _view.session().cur_snap_samplerate() * _view.scale();
58 const double cur_offset = _index / samples_per_pixel;
59 if (cur_offset < _view.offset() ||
60 cur_offset > (_view.offset() + _view.width())) {
61 visible = false;
62 return QRect(-1, -1, 0, 0);
63 }
64 const int64_t x = _view.index2pixel(_index, has_hoff);
65
66 const QSize label_size(
67 _text_size.width() + View::LabelPadding.width() * 2,
68 _text_size.height() + View::LabelPadding.height() * 2);
69 const int top = rect.height() - label_size.height() -
70 Cursor::Offset - Cursor::ArrowSize - 0.5f;
71 const int height = label_size.height();
72
73 visible = true;
74 return QRect(x - label_size.width() / 2, top, label_size.width(), height);
75}
76
77QRect Cursor::get_close_rect(const QRect &rect)
78{

Callers 1

mousePressEventMethod · 0.80

Calls 6

cur_snap_samplerateMethod · 0.80
sessionMethod · 0.80
scaleMethod · 0.80
offsetMethod · 0.80
index2pixelMethod · 0.80
QRectClass · 0.70

Tested by

no test coverage detected