X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftabular_decoder%2Fmodel.cpp;h=def753b2fa44b99f8e71d1db508ed103d25b422d;hb=883041605ce8536ece950b1de191cfe71068dfba;hp=b87bf05869ef1f118ad69853ff3899ec4e1d097a;hpb=4d0f333acdcd747ffc542d77e679ce08af6031ae;p=pulseview.git diff --git a/pv/views/tabular_decoder/model.cpp b/pv/views/tabular_decoder/model.cpp index b87bf058..def753b2 100644 --- a/pv/views/tabular_decoder/model.cpp +++ b/pv/views/tabular_decoder/model.cpp @@ -164,8 +164,11 @@ uint8_t AnnotationCollectionModel::first_hidden_column() const QVariant AnnotationCollectionModel::headerData(int section, Qt::Orientation orientation, int role) const { + if ((section < 0) || (section >= (int)header_data_.size())) + return QVariant(); + if ((orientation == Qt::Horizontal) && (role == Qt::DisplayRole)) - return header_data_.at(section); + return header_data_[section]; return QVariant(); } @@ -225,7 +228,9 @@ void AnnotationCollectionModel::set_signal_and_segment(data::DecodeSignal* signa return; } - disconnect(this, SLOT(on_annotation_visibility_changed())); + if (signal_) + for (const shared_ptr& dec : signal_->decoder_stack()) + disconnect(dec.get(), nullptr, this, SLOT(on_annotation_visibility_changed())); all_annotations_ = signal->get_all_annotations_by_segment(current_segment); signal_ = signal; @@ -234,9 +239,10 @@ void AnnotationCollectionModel::set_signal_and_segment(data::DecodeSignal* signa connect(dec.get(), SIGNAL(annotation_visibility_changed()), this, SLOT(on_annotation_visibility_changed())); - if (hide_hidden_) + if (hide_hidden_) { update_annotations_without_hidden(); - else + dataset_ = &all_annotations_without_hidden_; + } else dataset_ = all_annotations_; if (!dataset_ || dataset_->empty()) {