X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fviewwidget.hpp;h=cfcbda43ff3b68db0679d6f4a44fd5e50017adf5;hp=6fd1ecefd1f853a2403fc880cacb36c1c699a108;hb=455bc29ab7bf8acb9b3520f8a59b8365309134ac;hpb=282905348863fe871a48c680bd12bc1dee364a43 diff --git a/pv/view/viewwidget.hpp b/pv/view/viewwidget.hpp index 6fd1ecef..cfcbda43 100644 --- a/pv/view/viewwidget.hpp +++ b/pv/view/viewwidget.hpp @@ -18,8 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PULSEVIEW_PV_VIEWWIDGET_H -#define PULSEVIEW_PV_VIEWWIDGET_H +#ifndef PULSEVIEW_PV_VIEWWIDGET_HPP +#define PULSEVIEW_PV_VIEWWIDGET_HPP #include @@ -28,7 +28,8 @@ class QTouchEvent; namespace pv { -namespace view { +namespace views { +namespace TraceView { class View; class ViewItem; @@ -40,13 +41,22 @@ class ViewWidget : public QWidget protected: ViewWidget(View &parent); + /** + * Indicates when a view item is being hovered over. + * @param item The item that is being hovered over, or @c nullptr + * if no view item is being hovered over. + * @remarks the default implementation does nothing. + */ + virtual void item_hover( + const std::shared_ptr &item); + /** * Indicates the event an a view item has been clicked. * @param item the view item that has been clicked. * @remarks the default implementation does nothing. */ virtual void item_clicked( - const std::shared_ptr &item); + const std::shared_ptr &item); /** * Returns true if the selection of row items allows dragging. @@ -85,7 +95,7 @@ protected: /** * Gets the items in the view widget. */ - virtual std::vector< std::shared_ptr > items() = 0; + virtual std::vector< std::shared_ptr > items() = 0; /** * Gets the first view item which has a hit-box that contains @c pt . @@ -93,7 +103,7 @@ protected: * @return the view item that has been found, or and empty * @c shared_ptr if no item was found. */ - virtual std::shared_ptr get_mouse_over_item( + virtual std::shared_ptr get_mouse_over_item( const QPoint &pt) = 0; /** @@ -112,12 +122,12 @@ protected: * Handles touch begin update and end events. * @param e the event that triggered this handler. */ - virtual bool touch_event(QTouchEvent *e); + virtual bool touch_event(QTouchEvent *event); protected: bool event(QEvent *event); - void mousePressEvent(QMouseEvent * event); + void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); @@ -130,14 +140,15 @@ Q_SIGNALS: void selection_changed(); protected: - pv::view::View &view_; + pv::views::TraceView::View &view_; QPoint mouse_point_; QPoint mouse_down_point_; std::shared_ptr mouse_down_item_; bool item_dragging_; }; -} // namespace view +} // namespace TraceView +} // namespace views } // namespace pv -#endif // PULSEVIEW_PV_VIEWWIDGET_H +#endif // PULSEVIEW_PV_VIEWWIDGET_HPP