From: Joel Holdsworth Date: Sun, 21 Dec 2014 13:28:16 +0000 (+0000) Subject: MarginWidget: Added item() method X-Git-Tag: pulseview-0.3.0~314 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=3e124bee223688078d60f007cfa078a1dcbfbfb3 MarginWidget: Added item() method --- diff --git a/pv/view/header.cpp b/pv/view/header.cpp index a2a7c505..83985eda 100644 --- a/pv/view/header.cpp +++ b/pv/view/header.cpp @@ -80,6 +80,11 @@ QSize Header::extended_size_hint() const return sizeHint() + QSize(ViewItem::HighlightRadius, 0); } +vector< shared_ptr > Header::items() +{ + return vector< shared_ptr >(view_.begin(), view_.end()); +} + shared_ptr Header::get_mouse_over_item(const QPoint &pt) { const QRect r(0, 0, width() - BaselineOffset, height()); diff --git a/pv/view/header.hpp b/pv/view/header.hpp index e2492643..867944c5 100644 --- a/pv/view/header.hpp +++ b/pv/view/header.hpp @@ -60,6 +60,11 @@ public: static const int BaselineOffset; private: + /** + * Gets the row items. + */ + std::vector< std::shared_ptr > items(); + /** * Gets the first view item which has a label that contains @c pt . * @param pt the point to search with. diff --git a/pv/view/marginwidget.hpp b/pv/view/marginwidget.hpp index de5c866f..bd74801b 100644 --- a/pv/view/marginwidget.hpp +++ b/pv/view/marginwidget.hpp @@ -47,6 +47,11 @@ public: virtual QSize extended_size_hint() const = 0; protected: + /** + * Gets the items in the margin widget. + */ + virtual std::vector< std::shared_ptr > items() = 0; + /** * Shows the popup of a the specified @c ViewItem . * @param item The item to show the popup for. diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 5b84d6d3..9f8de32f 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -76,6 +76,13 @@ QSize Ruler::extended_size_hint() const ViewItem::HighlightRadius); } +vector< shared_ptr > Ruler::items() +{ + const vector< shared_ptr > time_items(view_.time_items()); + return vector< shared_ptr >( + time_items.begin(), time_items.end()); +} + shared_ptr Ruler::get_mouse_over_item(const QPoint &pt) { const vector< shared_ptr > items(view_.time_items()); diff --git a/pv/view/ruler.hpp b/pv/view/ruler.hpp index 68e7eb58..e808b309 100644 --- a/pv/view/ruler.hpp +++ b/pv/view/ruler.hpp @@ -62,6 +62,11 @@ public: QSize extended_size_hint() const; private: + /** + * Gets the time items. + */ + std::vector< std::shared_ptr > items(); + /** * Gets the first view item which has a label that contains @c pt . * @param pt the point to search with.