]> sigrok.org Git - pulseview.git/blobdiff - pv/view/view.cpp
Fix #969 by scheduling another call after a small delay
[pulseview.git] / pv / view / view.cpp
index 61b03b2e16b8495b8d8c6e8f0093bb4b7830a978..1cb03afcf3cbf5f5c0fd33ebee12c226b5a5797e 100644 (file)
@@ -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<int> 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_)