zero_offset_ = 0;
custom_zero_offset_set_ = false;
updating_scroll_ = false;
- settings_restored_ = false;
+ restoring_state_ = false;
always_zoom_to_fit_ = false;
tick_period_ = 0;
tick_prefix_ = pv::util::SIPrefix::yocto;
grabbed_widget_ = nullptr;
hover_point_ = QPoint(-1, -1);
scroll_needs_defaults_ = true;
- saved_v_offset_ = 0;
scale_at_acq_start_ = 0;
offset_at_acq_start_ = 0;
- suppress_zoom_to_fit_after_acq_ = false;
show_cursors_ = false;
cursor_state_changed(show_cursors_);
// Make sure the standard bar's segment selector is in sync
set_segment_display_mode(segment_display_mode_);
+
+ scrollarea_->verticalScrollBar()->setRange(-100000000, 100000000);
}
Session& View::session()
}
if (settings.contains("v_offset")) {
+ // Note: see eventFilter() for additional information
saved_v_offset_ = settings.value("v_offset").toInt();
- set_v_offset(saved_v_offset_);
scroll_needs_defaults_ = false;
- // Note: see eventFilter() for additional information
}
- settings_restored_ = true;
- suppress_zoom_to_fit_after_acq_ = true;
+ restoring_state_ = true;
// Update the ruler so that it uses the new scale
calculate_tick_spacing();
// Disable sticky scrolling / always zoom to fit when acquisition runs
// and user drags the viewport
if ((scale_ == scale) && (offset_ != offset) &&
- (session_.get_capture_state() == Session::Running)) {
+ (session_.get_capture_state() == Session::Running)) {
if (sticky_scrolling_) {
sticky_scrolling_ = false;
// resized to their final sizes.
update_layout();
- if (settings_restored_)
+ if (restoring_state_)
determine_if_header_was_shrunk();
else
resize_header_to_fit();
scroll_needs_defaults_ = false;
}
- if (saved_v_offset_) {
+ if (restoring_state_)
set_v_offset(saved_v_offset_);
- saved_v_offset_ = 0;
- }
}
return QObject::eventFilter(object, event);
// the main view of this session (other trace views may be used for
// zooming and we don't want to mess them up)
bool state = settings.value(GlobalSettings::Key_View_ZoomToFitDuringAcq).toBool();
- if (is_main_view_ && state) {
+ if (is_main_view_ && state && !restoring_state_) {
always_zoom_to_fit_ = true;
always_zoom_to_fit_changed(always_zoom_to_fit_);
}
// Enable sticky scrolling if the setting is enabled
- sticky_scrolling_ = settings.value(GlobalSettings::Key_View_StickyScrolling).toBool();
+ sticky_scrolling_ = !restoring_state_ &&
+ settings.value(GlobalSettings::Key_View_StickyScrolling).toBool();
// Reset all traces to segment 0
current_segment_ = 0;
// Only perform zoom-to-fit if the user hasn't altered the viewport and
// we didn't restore settings in the meanwhile
if (zoom_to_fit_after_acq &&
- !suppress_zoom_to_fit_after_acq_ &&
+ !restoring_state_ &&
(scale_ == scale_at_acq_start_) &&
- (offset_ == offset_at_acq_start_))
+ (sticky_scrolling_ || (offset_ == offset_at_acq_start_))) {
zoom_fit(false); // We're stopped, so the GUI state doesn't matter
+ }
- suppress_zoom_to_fit_after_acq_ = false;
+ restoring_state_ = false;
}
}
bool custom_zero_offset_set_;
bool updating_scroll_;
- bool settings_restored_;
+ bool restoring_state_;
bool header_was_shrunk_;
bool sticky_scrolling_;
// This is true when the defaults couldn't be set due to insufficient info
bool scroll_needs_defaults_;
- // A nonzero value indicates the v offset to restore. See View::resizeEvent()
+ // The v offset to restore. See View::eventFilter()
int saved_v_offset_;
// These are used to determine whether the view was altered after acq started
double scale_at_acq_start_;
pv::util::Timestamp offset_at_acq_start_;
-
- // Used to suppress performing a "zoom to fit" when the session stops. This
- // is needed when the view's settings are restored before acquisition ends.
- // In that case we want to keep the restored settings, not have a "zoom to fit"
- // mess them up.
- bool suppress_zoom_to_fit_after_acq_;
};
} // namespace trace