From: Soeren Apel Date: Wed, 20 Apr 2016 16:15:12 +0000 (+0200) Subject: DecodeTrace: Make sure first row's label width can be calculated X-Git-Tag: pulseview-0.4.0~301 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=cd0c558b8e1dbae12c3faba2349d874942b96066 DecodeTrace: Make sure first row's label width can be calculated Without a pen set, p.boundingRect() returns 0. All other rows have their label text width calculated with a pen, which makes p.boundingRect() work as intended. Fix this by setting a pen before the first row is processed. --- diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index 20de3755..9e41bc4a 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -198,6 +198,9 @@ void DecodeTrace::paint_mid(QPainter &p, const ViewItemPaintParams &pp) return; } + // Set default pen to allow for text width calculation + p.setPen(Qt::black); + // Iterate through the rows int y = get_visual_y(); pair sample_range = get_sample_range(