]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/decodetrace.cpp
DecodeTrace: Fix trace resizing when new annotation classes appear
[pulseview.git] / pv / views / trace / decodetrace.cpp
index 21d88923ef1c5732f3a0f3ef1394219c2ead7907..9529c50a72650958ce7f0b3abdc93b67a01a6f21 100644 (file)
@@ -56,14 +56,11 @@ extern "C" {
 using std::all_of;
 using std::make_pair;
 using std::max;
-using std::map;
 using std::min;
 using std::out_of_range;
 using std::pair;
 using std::shared_ptr;
-using std::make_shared;
 using std::tie;
-using std::unordered_set;
 using std::vector;
 
 using pv::data::decode::Annotation;
@@ -251,11 +248,13 @@ void DecodeTrace::paint_mid(QPainter &p, ViewItemPaintParams &pp)
        // Draw the hatching
        draw_unresolved_period(p, annotation_height, pp.left(), pp.right());
 
-       if ((int)visible_rows_.size() > max_visible_rows_)
-               owner_->extents_changed(false, true);
+       if ((int)visible_rows_.size() > max_visible_rows_) {
+               max_visible_rows_ = (int)visible_rows_.size();
 
-       // Update the maximum row count if needed
-       max_visible_rows_ = max(max_visible_rows_, (int)visible_rows_.size());
+               // Call order is important, otherwise the lazy event handler won't work
+               owner_->extents_changed(false, true);
+               owner_->row_item_appearance_changed(false, true);
+       }
 }
 
 void DecodeTrace::paint_fore(QPainter &p, ViewItemPaintParams &pp)
@@ -719,6 +718,12 @@ void DecodeTrace::hover_point_changed()
        assert(view);
 
        QPoint hp = view->hover_point();
+
+       if (hp.x() == 0) {
+               QToolTip::hideText();
+               return;
+       }
+
        QString ann = get_annotation_at_point(hp);
 
        assert(view);