]> sigrok.org Git - pulseview.git/commitdiff
CursorHeader: Do not clip away the selection.
authorJens Steinhauser <redacted>
Sat, 24 May 2014 14:41:22 +0000 (16:41 +0200)
committerJens Steinhauser <redacted>
Sat, 24 May 2014 16:33:43 +0000 (18:33 +0200)
pv/view/cursorheader.cpp
pv/view/cursorheader.h

index 6592acd4d06d43490688f4484dd12c6cbe282dfe..a9b709f2ecc30966a70e86350133d00bce340b4f 100644 (file)
@@ -35,6 +35,7 @@ namespace pv {
 namespace view {
 
 const int CursorHeader::Padding = 20;
 namespace view {
 
 const int CursorHeader::Padding = 20;
+const int CursorHeader::BaselineOffset = 5;
 
 int CursorHeader::calculateTextHeight()
 {
 
 int CursorHeader::calculateTextHeight()
 {
@@ -53,7 +54,7 @@ CursorHeader::CursorHeader(View &parent) :
 
 QSize CursorHeader::sizeHint() const
 {
 
 QSize CursorHeader::sizeHint() const
 {
-       return QSize(0, _textHeight + Padding);
+       return QSize(0, _textHeight + Padding + BaselineOffset);
 }
 
 void CursorHeader::clear_selection()
 }
 
 void CursorHeader::clear_selection()
@@ -74,7 +75,11 @@ void CursorHeader::paintEvent(QPaintEvent*)
 
        // Draw the cursors
        if (_view.cursors_shown()) {
 
        // Draw the cursors
        if (_view.cursors_shown()) {
-               _view.cursors().draw_markers(p, rect(), prefix);
+               // 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, prefix);
        }
 }
 
        }
 }
 
@@ -127,8 +132,8 @@ void CursorHeader::mouseReleaseEvent(QMouseEvent *)
        if (!_dragging)
                if (shared_ptr<TimeMarker> m = _grabbed_marker.lock()) {
                        Popup *const p = m->create_popup(&_view);
        if (!_dragging)
                if (shared_ptr<TimeMarker> m = _grabbed_marker.lock()) {
                        Popup *const p = m->create_popup(&_view);
-                       p->set_position(mapToGlobal(QPoint(m->get_x(),
-                               height())), Popup::Bottom);
+                       const QPoint arrpos(m->get_x(), height() - BaselineOffset);
+                       p->set_position(mapToGlobal(arrpos), Popup::Bottom);
                        p->show();
                }
 
                        p->show();
                }
 
index ff1759d47eb324b32e2ebfdb3948bc5674763d66..d3124be95baa53eeba4bb9be0951f7142f00c012 100644 (file)
@@ -39,6 +39,12 @@ class CursorHeader : public MarginWidget
 
        static const int Padding;
 
 
        static const int Padding;
 
+       /**
+        * The vertical offset, relative to the bottom line of the widget,
+        * where the arrows of the cursor labels end.
+        */
+       static const int BaselineOffset;
+
 public:
        CursorHeader(View &parent);
 
 public:
        CursorHeader(View &parent);