X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fcursorheader.cpp;h=076b2a7fc2ecd677ea12b99e16d08f7f3f1c2910;hp=1a656eb19f5edac14b7595c7db6569fa45de0822;hb=5c5ce7574062e0d3ad4f7d9dde70b482315d54fb;hpb=5a0192d4091b29e1e8e103482a498bd6c050c666 diff --git a/pv/view/cursorheader.cpp b/pv/view/cursorheader.cpp index 1a656eb1..076b2a7f 100644 --- a/pv/view/cursorheader.cpp +++ b/pv/view/cursorheader.cpp @@ -71,14 +71,14 @@ void CursorHeader::paintEvent(QPaintEvent*) QPainter p(this); p.setRenderHint(QPainter::Antialiasing); + // The cursor labels are not drawn with the arrows exactly on the + // bottom line of the widget, because then the selection shadow + // would be clipped away. + const QRect r = rect().adjusted(0, 0, 0, -BaselineOffset); + // Draw the cursors - if (view_.cursors_shown()) { - // The cursor labels are not drawn with the arrows exactly on the - // bottom line of the widget, because then the selection shadow - // would be clipped away. - const QRect r = rect().adjusted(0, 0, 0, -BaselineOffset); - view_.cursors().draw_markers(p, r); - } + if (view_.cursors_shown()) + view_.cursors()->draw_markers(p, r); } void CursorHeader::mouseMoveEvent(QMouseEvent *e) @@ -107,13 +107,13 @@ void CursorHeader::mousePressEvent(QMouseEvent *e) clear_selection(); if (view_.cursors_shown()) { - CursorPair &cursors = view_.cursors(); - if (cursors.first()->get_label_rect( + shared_ptr cursors(view_.cursors()); + if (cursors->first()->get_label_rect( rect()).contains(e->pos())) - grabbed_marker_ = cursors.first(); - else if (cursors.second()->get_label_rect( + grabbed_marker_ = cursors->first(); + else if (cursors->second()->get_label_rect( rect()).contains(e->pos())) - grabbed_marker_ = cursors.second(); + grabbed_marker_ = cursors->second(); } if (shared_ptr m = grabbed_marker_.lock())