X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Fview.cpp;h=eeda37ccfdbd1b1dc241b7ac7990d26f37af55d1;hb=4c7a19d3d7049bcc9fb3185ce2bc91333a7ca9e1;hp=1cb03afcf3cbf5f5c0fd33ebee12c226b5a5797e;hpb=2a9fcd6212fd54d9589717670824d6bd020c694a;p=pulseview.git diff --git a/pv/view/view.cpp b/pv/view/view.cpp index 1cb03af..eeda37c 100644 --- a/pv/view/view.cpp +++ b/pv/view/view.cpp @@ -129,6 +129,7 @@ View::View(Session &session, bool is_main_view, QWidget *parent) : scale_(1e-3), offset_(0), updating_scroll_(false), + settings_restored_(false), sticky_scrolling_(false), // Default setting is set in MainWindow::setup_ui() always_zoom_to_fit_(false), tick_period_(0), @@ -140,7 +141,7 @@ View::View(Session &session, bool is_main_view, QWidget *parent) : next_flag_text_('A'), trigger_markers_(), hover_point_(-1, -1), - scroll_needs_defaults_(false), + scroll_needs_defaults_(true), saved_v_offset_(0) { QVBoxLayout *root_layout = new QVBoxLayout(this); @@ -351,6 +352,8 @@ void View::restore_settings(QSettings &settings) scroll_needs_defaults_ = false; // Note: see eventFilter() for additional information } + + settings_restored_ = true; } vector< shared_ptr > View::time_items() const @@ -889,13 +892,6 @@ 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()); @@ -1020,6 +1016,9 @@ bool View::eventFilter(QObject *object, QEvent *event) // resized to their final sizes. update_layout(); + if (!settings_restored_) + expand_header_to_fit(); + if (scroll_needs_defaults_) { set_scroll_default(); scroll_needs_defaults_ = false; @@ -1086,11 +1085,6 @@ 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_)