From: Joel Holdsworth Date: Sat, 20 Dec 2014 17:42:06 +0000 (+0000) Subject: Ruler: Removed Padding X-Git-Tag: pulseview-0.3.0~329 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f5b833c6aa7e5a4f2e9b3b60464aab0a3196ed68;p=pulseview.git Ruler: Removed Padding --- 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);