]> sigrok.org Git - pulseview.git/blobdiff - pv/view/trace.cpp
Trace/AnalogSignal: Improve contrast and precision of the trace lines
[pulseview.git] / pv / view / trace.cpp
index f7e7ebf25b8ec00a351bb415f7fe696de155e8b6..fd6107f63acc9e643518226525593b012ac61485 100644 (file)
@@ -38,7 +38,7 @@
 namespace pv {
 namespace view {
 
-const QPen Trace::AxisPen(QColor(128, 128, 128, 64));
+const QPen Trace::AxisPen(QColor(0, 0, 0, 30*256/100));
 const int Trace::LabelHitPadding = 2;
 
 const QColor Trace::DarkBGColour(235, 235, 235);    // Quite light grey
@@ -80,17 +80,6 @@ void Trace::set_coloured_bg(bool state)
        coloured_bg_ = state;
 }
 
-bool Trace::is_draggable() const
-{
-       const View *const view = owner_->view();
-       assert(view);
-
-       QPoint cursor_pos = view->mapFromGlobal(QCursor::pos());
-
-       // The signal is draggable only in the header area
-       return (cursor_pos.x() <= view->header_size().width());
-}
-
 void Trace::paint_label(QPainter &p, const QRect &rect, bool hover)
 {
        const int y = get_visual_y();
@@ -186,13 +175,6 @@ QRectF Trace::label_rect(const QRectF &rect) const
                label_size.height());
 }
 
-QRectF Trace::hit_box_rect(const ViewItemPaintParams &pp) const
-{
-       const float h = QFontMetrics(QApplication::font()).height();
-       return QRectF(pp.left(), get_visual_y() - h / 2.0f,
-               pp.width(), h);
-}
-
 void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
 {
        if (coloured_bg_)
@@ -214,8 +196,12 @@ void Trace::paint_back(QPainter &p, const ViewItemPaintParams &pp)
 
 void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)
 {
+       p.setRenderHint(QPainter::Antialiasing, false);
+
        p.setPen(AxisPen);
-       p.drawLine(QPointF(pp.left(), y + 0.5f), QPointF(pp.right(), y + 0.5f));
+       p.drawLine(QPointF(pp.left(), y), QPointF(pp.right(), y));
+
+       p.setRenderHint(QPainter::Antialiasing, true);
 }
 
 void Trace::add_colour_option(QWidget *parent, QFormLayout *form)