From: Soeren Apel Date: Sun, 23 Feb 2020 18:30:19 +0000 (+0100) Subject: TraceView: Prevent decode traces from changing order X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=38b77a3ba1738aebf516491cc95e25219938a877;p=pulseview.git TraceView: Prevent decode traces from changing order Before, decode traces sometimes switched places when opening a class selector because max_visible_rows was reset to 0 which makes v_extents() return a value so small that the next decode trace would move up. Also, triggering the lazy event handler was changed so that it fires even when it's triggered several times. Before, it would always reset and only fire once, after the triggering stopped. That is undesirable when a class selector opens. --- diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 06db5055..d826587e 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -256,7 +256,7 @@ void DecodeTrace::set_owner(TraceTreeItemOwner *owner) pair DecodeTrace::v_extents() const { // Make an empty decode trace appear symmetrical - if (max_visible_rows_ == 0) + if (visible_rows_ == 0) return make_pair(-default_row_height_, default_row_height_); unsigned int height = 0; diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index e5cf980a..26282a78 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -203,6 +203,7 @@ View::View(Session &session, bool is_main_view, QMainWindow *parent) : connect(&lazy_event_handler_, SIGNAL(timeout()), this, SLOT(process_sticky_events())); lazy_event_handler_.setSingleShot(true); + lazy_event_handler_.setInterval(1000 / ViewBase::MaxViewAutoUpdateRate); // Set up local keyboard shortcuts zoom_in_shortcut_ = new QShortcut(QKeySequence(Qt::Key_Plus), this, @@ -1553,8 +1554,8 @@ void View::extents_changed(bool horz, bool vert) (horz ? TraceTreeItemHExtentsChanged : 0) | (vert ? TraceTreeItemVExtentsChanged : 0); - lazy_event_handler_.stop(); - lazy_event_handler_.start(); + if (!lazy_event_handler_.isActive()) + lazy_event_handler_.start(); } void View::on_signal_name_changed()