]> sigrok.org Git - pulseview.git/commitdiff
Ruler: Made HoverArrowSize proportional to text size
authorJoel Holdsworth <redacted>
Sat, 20 Dec 2014 12:28:27 +0000 (12:28 +0000)
committerJoel Holdsworth <redacted>
Sun, 28 Dec 2014 18:52:53 +0000 (18:52 +0000)
pv/view/ruler.cpp
pv/view/ruler.hpp

index e0ee753138df1c6495e686070262481188d87648..ceb90a45193935703d89e8af92dc30fd98f96940 100644 (file)
@@ -41,7 +41,7 @@ namespace view {
 const float Ruler::RulerHeight = 2.5f;  // x Text Height
 const int Ruler::MinorTickSubdivision = 4;
 
-const int Ruler::HoverArrowSize = 5;
+const float Ruler::HoverArrowSize = 0.5f;  // x Text Height
 
 const int Ruler::Padding = 20;
 const int Ruler::BaselineOffset = 5;
@@ -252,10 +252,11 @@ void Ruler::draw_hover_mark(QPainter &p, int text_height)
        p.setBrush(QBrush(palette().color(foregroundRole())));
 
        const int b = RulerHeight * text_height;
+       const float hover_arrow_size = HoverArrowSize * text_height;
        const QPointF points[] = {
                QPointF(x, b),
-               QPointF(x - HoverArrowSize, b - HoverArrowSize),
-               QPointF(x + HoverArrowSize, b - HoverArrowSize)
+               QPointF(x - hover_arrow_size, b - hover_arrow_size),
+               QPointF(x + hover_arrow_size, b - hover_arrow_size)
        };
        p.drawPolygon(points, countof(points));
 }
index c2b198ea280e47a6b037b0eaa2e387deb6068aa6..864d611dda4607479d6bbc2f55394d5fab6d0071 100644 (file)
@@ -41,7 +41,8 @@ private:
 
        static const int MinorTickSubdivision;
 
-       static const int HoverArrowSize;
+       /// Height of the hover arrow in multiples of the text height
+       static const float HoverArrowSize;
 
        static const int Padding;