]> sigrok.org Git - pulseview.git/blobdiff - pv/signal.cpp
Pixel aligned signal labels
[pulseview.git] / pv / signal.cpp
index c23a3954455b155d74b042907c361fa245f18c3a..9bc44d9d161d2fbe6316d6b291ba1bb0f3530158 100644 (file)
@@ -21,6 +21,7 @@
 #include <extdef.h>
 
 #include "signal.h"
+#include "view/view.h"
 
 namespace pv {
 
@@ -105,13 +106,14 @@ QRectF Signal::get_label_rect(const QRect &rect)
 {
        using pv::view::View;
 
-       const float nominal_offset = get_nominal_offset(rect);
+       const float nominal_offset = get_nominal_offset(rect) + 0.5;
        const QSizeF label_size(
                _text_size.width() + View::LabelPadding.width() * 2,
                _text_size.height() + View::LabelPadding.height() * 2);
        const float label_arrow_length = label_size.height() / 2;
        return QRectF(
-               rect.right() - label_arrow_length - label_size.width(),
+               rect.right() - label_arrow_length -
+                       label_size.width() - 0.5,
                nominal_offset - label_size.height() / 2,
                label_size.width(), label_size.height());
 }