]> sigrok.org Git - pulseview.git/blobdiff - pv/view/trace.cpp
Prefer Qt string multi-arg form over arg chaining.
[pulseview.git] / pv / view / trace.cpp
index 3727afa2de246912c8834dc0f3977d5131ec25bc..264541cf18c09f4ca9e5e7b9aebe4431209c22e4 100644 (file)
@@ -41,6 +41,9 @@ namespace view {
 const QPen Trace::AxisPen(QColor(128, 128, 128, 64));
 const int Trace::LabelHitPadding = 2;
 
+const QColor Trace::DarkBGColour(235, 235, 235);    // Quite light grey
+const QColor Trace::BrightBGColour(245, 245, 245);  // Very light grey
+
 Trace::Trace(QString name) :
        name_(name),
        coloured_bg_(true), // Default setting is set in MainWindow::setup_ui()
@@ -172,28 +175,23 @@ 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_) {
-               p.setPen(QPen(Qt::NoPen));
+       if (coloured_bg_)
                p.setBrush(bgcolour_);
+       else
+               p.setBrush(bgcolour_state_ ? BrightBGColour : DarkBGColour);
 
-               const std::pair<int, int> extents = v_extents();
+       p.setPen(QPen(Qt::NoPen));
 
-               const int x = 0;
-               const int y = get_visual_y() + extents.first;
-               const int w = pp.right() - pp.left();
-               const int h = extents.second - extents.first;
+       const std::pair<int, int> extents = v_extents();
 
-               p.drawRect(x, y, w, h);
-       }
+       const int x = 0;
+       const int y = get_visual_y() + extents.first;
+       const int w = pp.right() - pp.left();
+       const int h = extents.second - extents.first;
+
+       p.drawRect(x, y, w, h);
 }
 
 void Trace::paint_axis(QPainter &p, const ViewItemPaintParams &pp, int y)