X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fviews%2Ftrace%2Fdecodetrace.cpp;h=888064d09e12583cde3937eaab98fdee725e43bc;hb=ffad6cd6856a0e0de36cad164d9d09e06c0ec52a;hp=2902c936552757ee1c88160a32d0f2b8d24ca82a;hpb=f6a93932056dab5e2f75207b65197b436d4141a5;p=pulseview.git diff --git a/pv/views/trace/decodetrace.cpp b/pv/views/trace/decodetrace.cpp index 2902c936..888064d0 100644 --- a/pv/views/trace/decodetrace.cpp +++ b/pv/views/trace/decodetrace.cpp @@ -17,9 +17,7 @@ * along with this program; if not, see . */ -extern "C" { #include -} #include #include @@ -1032,8 +1030,17 @@ const QString DecodeTrace::get_annotation_at_point(const QPoint &point) decode_signal_->get_annotation_subset(annotations, r->decode_row, current_segment_, sample_range.first, sample_range.second); - return (annotations.empty()) ? - QString() : annotations[0]->annotations()->front(); + const Annotation* a = annotations.empty() ? nullptr : annotations[0]; + + // Create a string of the format "CLASS: VALUE" + QString s; + if (a) { + if (!a->ann_class_description().isEmpty()) + s = a->ann_class_description() + ": "; + s += a->annotations()->front(); + } + + return s; } void DecodeTrace::create_decoder_form(int index, shared_ptr &dec, @@ -1131,10 +1138,9 @@ QComboBox* DecodeTrace::create_channel_selector(QWidget *parent, const DecodeCha for (const shared_ptr &b : sig_list) { assert(b); if (b->logic_data() && b->enabled()) { - selector->addItem(b->name(), - QVariant::fromValue((void*)b.get())); + selector->addItem(b->name(), QVariant::fromValue(b)); - if (ch->assigned_signal == b.get()) + if (ch->assigned_signal == b) selector->setCurrentIndex(selector->count() - 1); } } @@ -1523,8 +1529,8 @@ void DecodeTrace::on_channel_selected(int) QComboBox *cb = qobject_cast(QObject::sender()); // Determine signal that was selected - const data::SignalBase *signal = - (data::SignalBase*)cb->itemData(cb->currentIndex()).value(); + shared_ptr signal = + cb->itemData(cb->currentIndex()).value>(); // Determine decode channel ID this combo box is the channel selector for const uint16_t id = channel_id_map_.at(cb);