From: Joel Holdsworth Date: Sat, 6 Dec 2014 23:11:29 +0000 (+0000) Subject: SelectableItem: Moved in enabled(), and added to TriggerMarkers X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=commitdiff_plain;h=096fb584db59a7b95ea57a6accf6c282a43497f6 SelectableItem: Moved in enabled(), and added to TriggerMarkers --- diff --git a/pv/view/cursor.cpp b/pv/view/cursor.cpp index 6a47331..f4a5df6 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 fab7497..b23bd64 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 39c6f04..4f973e3 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 1f59449..29a5c95 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 7e23806..2f129a3 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));