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

index 04e4c764845ce80c64ab6ac8bf9f0fb8ec935f58..a2a7c505cfd420c5b6b66e3e6224795c7ecdabe9 100644 (file)
@@ -80,7 +80,7 @@ QSize Header::extended_size_hint() const
        return sizeHint() + QSize(ViewItem::HighlightRadius, 0);
 }
 
-shared_ptr<RowItem> Header::get_mouse_over_item(const QPoint &pt)
+shared_ptr<ViewItem> Header::get_mouse_over_item(const QPoint &pt)
 {
        const QRect r(0, 0, width() - BaselineOffset, height());
        for (auto &i : view_)
@@ -174,7 +174,7 @@ void Header::mouseLeftReleaseEvent(QMouseEvent *event)
                QApplication::keyboardModifiers() & Qt::ControlModifier;
 
        // Unselect everything if control is not pressed
-       const shared_ptr<RowItem> mouse_over =
+       const shared_ptr<ViewItem> mouse_over =
                get_mouse_over_item(event->pos());
 
        for (auto &r : view_)
@@ -254,7 +254,7 @@ void Header::mouseMoveEvent(QMouseEvent *event)
 
 void Header::contextMenuEvent(QContextMenuEvent *event)
 {
-       const shared_ptr<RowItem> r = get_mouse_over_item(mouse_point_);
+       const shared_ptr<ViewItem> r = get_mouse_over_item(mouse_point_);
        if (!r)
                return;
 
index 3c94f791c730d683b374cc4e16aafacbfa3ea1f2..e249264330a074c65cbe51559d9fbde54844c412 100644 (file)
@@ -32,6 +32,7 @@ namespace view {
 
 class RowItem;
 class View;
+class ViewItem;
 
 class Header : public MarginWidget
 {
@@ -59,7 +60,13 @@ public:
        static const int BaselineOffset;
 
 private:
-       std::shared_ptr<pv::view::RowItem> 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);
 
        void clear_selection();