From: Soeren Apel Date: Thu, 21 Jun 2018 18:23:08 +0000 (+0200) Subject: LogicSignal: Don't paint hover marker if channel is disabled X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=cab7bc996c9c87120b0c551caa47d8dd53d84ea9;p=pulseview.git LogicSignal: Don't paint hover marker if channel is disabled --- diff --git a/pv/views/trace/logicsignal.cpp b/pv/views/trace/logicsignal.cpp index 79065ebd..c1295591 100644 --- a/pv/views/trace/logicsignal.cpp +++ b/pv/views/trace/logicsignal.cpp @@ -293,41 +293,43 @@ void LogicSignal::paint_mid(QPainter &p, ViewItemPaintParams &pp) void LogicSignal::paint_fore(QPainter &p, ViewItemPaintParams &pp) { - // Draw the trigger marker - if (base_->enabled() && trigger_match_) { - const int y = get_visual_y(); - - for (int32_t type_id : trigger_types_) { - const TriggerMatchType *const type = - TriggerMatchType::get(type_id); - if (trigger_match_ != type || type_id < 0 || - (size_t)type_id >= countof(TriggerMarkerIcons) || - !TriggerMarkerIcons[type_id]) - continue; + if (base_->enabled()) { + if (trigger_match_) { + // Draw the trigger marker + const int y = get_visual_y(); + + for (int32_t type_id : trigger_types_) { + const TriggerMatchType *const type = + TriggerMatchType::get(type_id); + if (trigger_match_ != type || type_id < 0 || + (size_t)type_id >= countof(TriggerMarkerIcons) || + !TriggerMarkerIcons[type_id]) + continue; - const QPixmap *const pixmap = get_pixmap( - TriggerMarkerIcons[type_id]); - if (!pixmap) - continue; + const QPixmap *const pixmap = get_pixmap( + TriggerMarkerIcons[type_id]); + if (!pixmap) + continue; - const float pad = TriggerMarkerPadding - 0.5f; - const QSize size = pixmap->size(); - const QPoint point( - pp.right() - size.width() - pad * 2, - y - (signal_height_ + size.height()) / 2); + const float pad = TriggerMarkerPadding - 0.5f; + const QSize size = pixmap->size(); + const QPoint point( + pp.right() - size.width() - pad * 2, + y - (signal_height_ + size.height()) / 2); - p.setPen(QPen(TriggerMarkerBackgroundColor.darker())); - p.setBrush(TriggerMarkerBackgroundColor); - p.drawRoundedRect(QRectF(point, size).adjusted( - -pad, -pad, pad, pad), pad, pad); - p.drawPixmap(point, *pixmap); + p.setPen(QPen(TriggerMarkerBackgroundColor.darker())); + p.setBrush(TriggerMarkerBackgroundColor); + p.drawRoundedRect(QRectF(point, size).adjusted( + -pad, -pad, pad, pad), pad, pad); + p.drawPixmap(point, *pixmap); - break; + break; + } } - } - if (show_hover_marker_) - paint_hover_marker(p); + if (show_hover_marker_) + paint_hover_marker(p); + } } void LogicSignal::paint_caps(QPainter &p, QLineF *const lines,