From: Joel Holdsworth Date: Sat, 20 Dec 2014 12:28:27 +0000 (+0000) Subject: Ruler: Made HoverArrowSize proportional to text size X-Git-Tag: pulseview-0.3.0~335 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=415341a11f0023cc9cec7b62cf8058c84c8b7ea6;p=pulseview.git Ruler: Made HoverArrowSize proportional to text size --- diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index e0ee7531..ceb90a45 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -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)); } diff --git a/pv/view/ruler.hpp b/pv/view/ruler.hpp index c2b198ea..864d611d 100644 --- a/pv/view/ruler.hpp +++ b/pv/view/ruler.hpp @@ -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;