]> sigrok.org Git - pulseview.git/commitdiff
TraceView: Prevent decode traces from changing order
authorSoeren Apel <redacted>
Sun, 23 Feb 2020 18:30:19 +0000 (19:30 +0100)
committerSoeren Apel <redacted>
Sun, 23 Feb 2020 18:30:19 +0000 (19:30 +0100)
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.

pv/views/trace/decodetrace.cpp
pv/views/trace/view.cpp

index 06db505596f0331932fca77d51e23c74323106db..d826587e507fbcbf03464cc8292700bf5b44ea3e 100644 (file)
@@ -256,7 +256,7 @@ void DecodeTrace::set_owner(TraceTreeItemOwner *owner)
 pair<int, int> 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;
index e5cf980a79223b1a84412fb1c845070194d4458d..26282a78debed7fa569b8c7fd7ab4824288877d2 100644 (file)
@@ -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()