From: Joel Holdsworth Date: Sun, 7 Dec 2014 00:00:53 +0000 (+0000) Subject: CursorPair: Derived from TimeItem X-Git-Tag: pulseview-0.3.0~383 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5a0192d4091b29e1e8e103482a498bd6c050c666;p=pulseview.git CursorPair: Derived from TimeItem --- diff --git a/pv/view/cursorpair.cpp b/pv/view/cursorpair.cpp index 12b7bc34..0370793d 100644 --- a/pv/view/cursorpair.cpp +++ b/pv/view/cursorpair.cpp @@ -38,12 +38,17 @@ namespace view { const int CursorPair::DeltaPadding = 8; CursorPair::CursorPair(View &view) : + TimeItem(view), first_(new Cursor(view, 0.0)), - second_(new Cursor(view, 1.0)), - view_(view) + second_(new Cursor(view, 1.0)) { } +bool CursorPair::enabled() const +{ + return view_.cursors_shown(); +} + shared_ptr CursorPair::first() const { return first_; @@ -54,6 +59,17 @@ shared_ptr CursorPair::second() const return second_; } +QPoint CursorPair::point() const +{ + return first_->point(); +} + +pv::widgets::Popup* CursorPair::create_popup(QWidget *parent) +{ + (void)parent; + return nullptr; +} + QRectF CursorPair::get_label_rect(const QRect &rect) const { const QSizeF label_size( diff --git a/pv/view/cursorpair.hpp b/pv/view/cursorpair.hpp index 84737d21..12ed76af 100644 --- a/pv/view/cursorpair.hpp +++ b/pv/view/cursorpair.hpp @@ -32,7 +32,7 @@ class QPainter; namespace pv { namespace view { -class CursorPair +class CursorPair : public TimeItem { private: static const int DeltaPadding; @@ -44,6 +44,12 @@ public: */ CursorPair(View &view); +public: + /** + * Returns true if the item is visible and enabled. + */ + bool enabled() const; + /** * Returns a pointer to the first cursor. */ @@ -54,6 +60,10 @@ public: */ std::shared_ptr second() const; + QPoint point() const; + + pv::widgets::Popup* create_popup(QWidget *parent); + public: QRectF get_label_rect(const QRect &rect) const; @@ -69,7 +79,6 @@ public: private: std::shared_ptr first_, second_; - const View &view_; QSizeF text_size_; };