]> sigrok.org Git - pulseview.git/commitdiff
DecodeTrace: Make sure first row's label width can be calculated
authorSoeren Apel <redacted>
Wed, 20 Apr 2016 16:15:12 +0000 (18:15 +0200)
committerSoeren Apel <redacted>
Tue, 3 May 2016 19:11:33 +0000 (21:11 +0200)
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.

pv/view/decodetrace.cpp

index 20de3755be482688be6cc2ce4f28220c2bd84f5c..9e41bc4ac1f515f0a457ce2bff384820b040447e 100644 (file)
@@ -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<uint64_t, uint64_t> sample_range = get_sample_range(