]> sigrok.org Git - pulseview.git/commitdiff
View: Introduce settings_restored_
authorSoeren Apel <redacted>
Tue, 6 Jun 2017 13:57:27 +0000 (15:57 +0200)
committerSoeren Apel <redacted>
Tue, 6 Jun 2017 14:17:26 +0000 (16:17 +0200)
This way, UI elements can decide whether they can change UI
settings or whether they are already using user-set values.

pv/view/view.cpp
pv/view/view.hpp

index 1cb03afcf3cbf5f5c0fd33ebee12c226b5a5797e..f1486ad9c4cf733dfa8b170c6b1827edcf609621 100644 (file)
@@ -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),
@@ -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<TimeItem> > View::time_items() const
@@ -1088,7 +1091,9 @@ void View::on_splitter_moved()
 
 void View::on_repeat_splitter_expansion()
 {
-       expand_header_to_fit();
+       // Don't mess with the header if settings were restored in the meanwhile
+       if (!settings_restored_)
+               expand_header_to_fit();
 }
 
 void View::h_scroll_value_changed(int value)
index 9b6ce3ff2967c31283a499a3ff106a1aaa6fa430..08e17d6056867f45be84bee8b62d61cad70f45df 100644 (file)
@@ -426,6 +426,8 @@ private:
        pv::util::Timestamp offset_;
 
        bool updating_scroll_;
+       bool settings_restored_;
+
        bool sticky_scrolling_;
        bool coloured_bg_;
        bool always_zoom_to_fit_;