]> sigrok.org Git - pulseview.git/commitdiff
DecodeTrace: Add annotation class to hover text
authorSoeren Apel <redacted>
Thu, 26 Nov 2020 20:46:58 +0000 (21:46 +0100)
committerSoeren Apel <redacted>
Thu, 26 Nov 2020 20:46:58 +0000 (21:46 +0100)
pv/views/trace/decodetrace.cpp

index 5b9b3f36c586568111684bfbfc73fd491b1a208e..409f1d282abc209d7753509b42f2c810abf2f5eb 100644 (file)
@@ -1032,8 +1032,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);
 
        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<Decoder> &dec,
 }
 
 void DecodeTrace::create_decoder_form(int index, shared_ptr<Decoder> &dec,