]> sigrok.org Git - pulseview.git/blobdiff - pv/views/trace/viewwidget.hpp
Session: Fix issue #67 by improving error handling
[pulseview.git] / pv / views / trace / viewwidget.hpp
index e4fb73c8255debedb73963acddc0984e635a0433..ef3cfa2fc303d9692d84e596d486191888cda143 100644 (file)
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef PULSEVIEW_PV_VIEWWIDGET_HPP
-#define PULSEVIEW_PV_VIEWWIDGET_HPP
+#ifndef PULSEVIEW_PV_VIEWS_TRACE_VIEWWIDGET_HPP
+#define PULSEVIEW_PV_VIEWS_TRACE_VIEWWIDGET_HPP
 
 #include <memory>
 
+#include <QPoint>
 #include <QWidget>
 
+#include <pv/util.hpp>
+
 using std::shared_ptr;
 using std::vector;
 
@@ -49,7 +52,7 @@ protected:
         * if no view item is being hovered over.
         * @remarks the default implementation does nothing.
         */
-       virtual void item_hover(const shared_ptr<ViewItem> &item);
+       virtual void item_hover(const shared_ptr<ViewItem> &item, QPoint pos);
 
        /**
         * Indicates the event an a view item has been clicked.
@@ -130,6 +133,9 @@ protected:
        void mouseReleaseEvent(QMouseEvent *event);
        void mouseMoveEvent(QMouseEvent *event);
 
+       void keyPressEvent(QKeyEvent *event);
+       void keyReleaseEvent(QKeyEvent *event);
+
        void leaveEvent(QEvent *event);
 
 public Q_SLOTS:
@@ -142,7 +148,12 @@ protected:
        pv::views::trace::View &view_;
        QPoint mouse_point_;
        QPoint mouse_down_point_;
+       pv::util::Timestamp mouse_down_offset_;
        shared_ptr<ViewItem> mouse_down_item_;
+
+       /// Keyboard modifiers that were active when mouse was last moved or clicked
+       Qt::KeyboardModifiers mouse_modifiers_;
+
        bool item_dragging_;
 };
 
@@ -150,4 +161,4 @@ protected:
 } // namespace views
 } // namespace pv
 
-#endif // PULSEVIEW_PV_VIEWWIDGET_HPP
+#endif // PULSEVIEW_PV_VIEWS_TRACE_VIEWWIDGET_HPP