projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
View: Introduce settings_restored_
[pulseview.git]
/
pv
/
view
/
view.cpp
diff --git
a/pv/view/view.cpp
b/pv/view/view.cpp
index 61b03b2e16b8495b8d8c6e8f0093bb4b7830a978..f1486ad9c4cf733dfa8b170c6b1827edcf609621 100644
(file)
--- 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),
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),
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
}
scroll_needs_defaults_ = false;
// Note: see eventFilter() for additional information
}
+
+ settings_restored_ = true;
}
vector< shared_ptr<TimeItem> > View::time_items() const
}
vector< shared_ptr<TimeItem> > View::time_items() const
@@
-889,6
+892,13
@@
void View::expand_header_to_fit()
for (int w : splitter_->sizes())
splitter_area_width += w;
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());
// 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
+1089,13
@@
void View::on_splitter_moved()
expand_header_to_fit();
}
expand_header_to_fit();
}
+void View::on_repeat_splitter_expansion()
+{
+ // 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)
{
if (updating_scroll_)
void View::h_scroll_value_changed(int value)
{
if (updating_scroll_)