From f5b833c6aa7e5a4f2e9b3b60464aab0a3196ed68 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 20 Dec 2014 17:42:06 +0000 Subject: [PATCH 1/1] Ruler: Removed Padding --- pv/view/ruler.cpp | 11 ++++++----- pv/view/ruler.hpp | 2 -- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index ece80e2a..f671c95e 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -43,8 +43,6 @@ const int Ruler::MinorTickSubdivision = 4; const float Ruler::HoverArrowSize = 0.5f; // x Text Height -const int Ruler::Padding = 20; - Ruler::Ruler(View &parent) : MarginWidget(parent) { @@ -70,9 +68,12 @@ QSize Ruler::sizeHint() const QSize Ruler::extended_size_hint() const { - const int text_height = calculate_text_height(); - return QSize(0, RulerHeight * text_height + - (text_height + Padding + ViewItem::HighlightRadius) / 2); + QRectF max_rect; + std::vector< std::shared_ptr > items(view_.time_items()); + for (auto &i : items) + max_rect = max_rect.united(i->label_rect(QRect())); + return QSize(0, sizeHint().height() - max_rect.top() / 2 + + ViewItem::HighlightRadius); } void Ruler::paintEvent(QPaintEvent*) diff --git a/pv/view/ruler.hpp b/pv/view/ruler.hpp index f9409449..f6ce3446 100644 --- a/pv/view/ruler.hpp +++ b/pv/view/ruler.hpp @@ -44,8 +44,6 @@ private: /// Height of the hover arrow in multiples of the text height static const float HoverArrowSize; - static const int Padding; - public: Ruler(View &parent); -- 2.30.2