From: Joel Holdsworth Date: Sat, 6 Dec 2014 23:11:29 +0000 (+0000) Subject: SelectableItem: Moved in enabled(), and added to TriggerMarkers X-Git-Tag: pulseview-0.3.0~387 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=096fb584db59a7b95ea57a6accf6c282a43497f6;p=pulseview.git SelectableItem: Moved in enabled(), and added to TriggerMarkers --- diff --git a/pv/view/cursor.cpp b/pv/view/cursor.cpp index 6a473311..f4a5df6f 100644 --- a/pv/view/cursor.cpp +++ b/pv/view/cursor.cpp @@ -45,6 +45,11 @@ Cursor::Cursor(View &view, double time) : { } +bool Cursor::enabled() const +{ + return view_.cursors_shown(); +} + QString Cursor::get_text() const { return pv::util::format_time(time_, view_.tick_prefix(), 2); diff --git a/pv/view/cursor.hpp b/pv/view/cursor.hpp index fab7497e..b23bd642 100644 --- a/pv/view/cursor.hpp +++ b/pv/view/cursor.hpp @@ -48,6 +48,11 @@ public: Cursor(View &view, double time); public: + /** + * Returns true if the item is visible and enabled. + */ + bool enabled() const; + /** * Gets the text to show in the marker. */ diff --git a/pv/view/rowitem.hpp b/pv/view/rowitem.hpp index 39c6f040..4f973e3f 100644 --- a/pv/view/rowitem.hpp +++ b/pv/view/rowitem.hpp @@ -47,11 +47,6 @@ public: */ RowItem(); - /** - * Returns true if the item is visible and enabled. - */ - virtual bool enabled() const = 0; - /** * Gets the vertical layout offset of this signal. */ diff --git a/pv/view/selectableitem.hpp b/pv/view/selectableitem.hpp index 1f594490..29a5c955 100644 --- a/pv/view/selectableitem.hpp +++ b/pv/view/selectableitem.hpp @@ -48,6 +48,11 @@ public: SelectableItem(); public: + /** + * Returns true if the item is visible and enabled. + */ + virtual bool enabled() const = 0; + /** * Returns true if the item has been selected by the user. */ diff --git a/pv/view/timemarker.cpp b/pv/view/timemarker.cpp index 7e238068..2f129a32 100644 --- a/pv/view/timemarker.cpp +++ b/pv/view/timemarker.cpp @@ -107,6 +107,9 @@ QRectF TimeMarker::get_label_rect(const QRect &rect) const void TimeMarker::paint_label(QPainter &p, const QRect &rect) { + if (!enabled()) + return; + const qreal x = (time_ - view_.offset()) / view_.scale(); const QRectF r(get_label_rect(rect));