From: Soeren Apel Date: Tue, 6 Jun 2017 10:07:25 +0000 (+0200) Subject: Fix #969 by scheduling another call after a small delay X-Git-Tag: pulseview-0.4.0~29 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=2a9fcd6212fd54d9589717670824d6bd020c694a;p=pulseview.git Fix #969 by scheduling another call after a small delay --- diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 61b03b2e..1cb03afc 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -889,6 +889,13 @@ void View::expand_header_to_fit() for (int w : splitter_->sizes()) splitter_area_width += w; + // Workaround for when the header needs resizing but the view + // isn't visible yet and thus splitter_->sizes() returns (0, 0) + if (splitter_area_width == 0) { + QTimer::singleShot(50, this, SLOT(on_repeat_splitter_expansion())); + return; + } + // Make sure the header has enough horizontal space to show all labels fully QList pane_sizes; pane_sizes.push_back(header_->extended_size_hint().width()); @@ -1079,6 +1086,11 @@ void View::on_splitter_moved() expand_header_to_fit(); } +void View::on_repeat_splitter_expansion() +{ + expand_header_to_fit(); +} + void View::h_scroll_value_changed(int value) { if (updating_scroll_) diff --git a/pv/view/view.hpp b/pv/view/view.hpp index 76a38f16..9b6ce3ff 100644 --- a/pv/view/view.hpp +++ b/pv/view/view.hpp @@ -356,6 +356,8 @@ public: private Q_SLOTS: void on_splitter_moved(); + void on_repeat_splitter_expansion(); + void h_scroll_value_changed(int value); void v_scroll_value_changed();