]> sigrok.org Git - pulseview.git/commitdiff
CursorPair: Set font before calling compute_text_size
authorJoel Holdsworth <redacted>
Sat, 20 Dec 2014 10:38:40 +0000 (10:38 +0000)
committerJoel Holdsworth <redacted>
Sun, 28 Dec 2014 18:52:53 +0000 (18:52 +0000)
pv/view/cursorpair.cpp

index 859f6fdef4e129336b23cc038cddf6e31b107e73..c5a1bc9923beafb00c805eff8f331735a764bbdf 100644 (file)
@@ -110,7 +110,10 @@ void CursorPair::paint_label(QPainter &p, const QRect &rect)
                return;
 
        const unsigned int prefix = view_.tick_prefix();
+       const QColor text_colour =
+               ViewItem::select_text_colour(Cursor::FillColour);
 
+       p.setPen(text_colour);
        compute_text_size(p, prefix);
        QRectF delta_rect(label_rect(rect));
 
@@ -135,8 +138,7 @@ void CursorPair::paint_label(QPainter &p, const QRect &rect)
                p.setPen(Cursor::FillColour.lighter());
                p.drawRoundedRect(delta_rect, highlight_radius, highlight_radius);
 
-               p.setPen(ViewItem::select_text_colour(
-                       Cursor::FillColour));
+               p.setPen(text_colour);
                p.drawText(text_rect, Qt::AlignCenter | Qt::AlignVCenter,
                        pv::util::format_time(second_->time() - first_->time(), prefix, 2));
        }