]> sigrok.org Git - pulseview.git/commitdiff
Ruler: Make get_mouse_over_item return shared_ptr<ViewItem>
authorJoel Holdsworth <redacted>
Sun, 21 Dec 2014 11:38:25 +0000 (11:38 +0000)
committerJoel Holdsworth <redacted>
Mon, 29 Dec 2014 11:56:00 +0000 (11:56 +0000)
pv/view/ruler.cpp
pv/view/ruler.hpp

index 0c4dcb0bd13ed0c17cf47be2fa07cf737b051ded..5b84d6d321c445cad69afd0f13ea7a4383e9efa5 100644 (file)
@@ -76,7 +76,7 @@ QSize Ruler::extended_size_hint() const
                ViewItem::HighlightRadius);
 }
 
-shared_ptr<TimeItem> Ruler::get_mouse_over_item(const QPoint &pt)
+shared_ptr<ViewItem> Ruler::get_mouse_over_item(const QPoint &pt)
 {
        const vector< shared_ptr<TimeItem> > items(view_.time_items());
        for (auto i = items.rbegin(); i != items.rend(); i++)
@@ -216,7 +216,7 @@ void Ruler::mouseDoubleClickEvent(QMouseEvent *e)
 
 void Ruler::contextMenuEvent(QContextMenuEvent *event)
 {
-       const shared_ptr<TimeItem> r = get_mouse_over_item(mouse_point_);
+       const shared_ptr<ViewItem> r = get_mouse_over_item(mouse_point_);
        if (!r)
                return;
 
index 5720c9a98ddc8df71cce279b662bd3da4bd07152..68e7eb5884fcc751d0723ec13afbb80253937a43 100644 (file)
@@ -29,6 +29,7 @@ namespace pv {
 namespace view {
 
 class TimeItem;
+class ViewItem;
 
 class Ruler : public MarginWidget
 {
@@ -61,7 +62,13 @@ public:
        QSize extended_size_hint() const;
 
 private:
-       std::shared_ptr<pv::view::TimeItem> get_mouse_over_item(
+       /**
+        * Gets the first view item which has a label that contains @c pt .
+        * @param pt the point to search with.
+        * @return the view item that has been found, or and empty
+        *   @c shared_ptr if no item was found.
+        */
+       std::shared_ptr<pv::view::ViewItem> get_mouse_over_item(
                const QPoint &pt);
 
 private: