]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/decodetrace.cpp
Fix #1451 by only using decoder tags if they're available
[pulseview.git] / pv / views / trace / decodetrace.cpp
index c7796efcf8618784fd463d9d5840b265ee77fe78..e14b4ecbf433469467c5b820eabf534aac04e1c7 100644 (file)
@@ -70,7 +70,7 @@ using std::vector;
 
 using pv::data::decode::Annotation;
 using pv::data::decode::Row;
-using pv::data::DecodeChannel;
+using pv::data::decode::DecodeChannel;
 using pv::data::DecodeSignal;
 
 namespace pv {
@@ -198,9 +198,11 @@ void DecodeTrace::paint_mid(QPainter &p, ViewItemPaintParams &pp)
        for (const Row& row : rows) {
                // Cache the row title widths
                int row_title_width;
-               try {
-                       row_title_width = row_title_widths_.at(row);
-               } catch (out_of_range&) {
+               auto cached_width = row_title_widths_.find(row);
+
+               if (cached_width != row_title_widths_.end())
+                       row_title_width = cached_width->second;
+               else {
                        const int w = p.boundingRect(QRectF(), 0, row.title()).width() +
                                RowTitleMargin;
                        row_title_widths_[row] = w;
@@ -1217,7 +1219,7 @@ void DecodeTrace::on_copy_annotation_to_clipboard()
        if (annotations->empty())
                return;
 
-       QClipboard *clipboard = QGuiApplication::clipboard();
+       QClipboard *clipboard = QApplication::clipboard();
        clipboard->setText(annotations->front().annotations().front(), QClipboard::Clipboard);
 
        if (clipboard->supportsSelection())