Replaced use of QFontMetrics::boundingRect with height() and ascent()
[pulseview.git] / pv / view / timemarker.cpp
index ed9df36064f74407b1a1ee81f80d11378adbc81c..4b8d2b527a5992dc43c4e58f15c68d02dcf0312d 100644 (file)
@@ -87,7 +87,7 @@ QRectF TimeMarker::label_rect(const QRectF &rect) const
        QFontMetrics m(QApplication::font());
        const float text_width =
                max(m.boundingRect(get_text()).size().width(), ArrowSize);
-       const float text_height = m.boundingRect("Tg").size().height();
+       const float text_height = m.height();
 
        const QSizeF label_size(
                text_width + View::LabelPadding.width() * 2,
@@ -100,7 +100,7 @@ QRectF TimeMarker::label_rect(const QRectF &rect) const
                label_size.width(), height);
 }
 
-void TimeMarker::paint_label(QPainter &p, const QRect &rect)
+void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover)
 {
        if (!enabled())
                return;
@@ -136,7 +136,7 @@ void TimeMarker::paint_label(QPainter &p, const QRect &rect)
        }
 
        p.setPen(Qt::transparent);
-       p.setBrush(colour_);
+       p.setBrush(hover ? colour_.lighter() : colour_);
        p.drawPolygon(points, countof(points));
 
        p.setPen(colour_.lighter());