diff --git a/plotview.cpp b/plotview.cpp index 85b0e3d..7e0541b 100644 --- a/plotview.cpp +++ b/plotview.cpp @@ -36,6 +36,7 @@ PlotView::PlotView(InputSource *input) : cursors(this), viewRange({0, 0}) { mainSampleSource = input; + setDragMode(QGraphicsView::ScrollHandDrag); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); setMouseTracking(true); enableCursors(false); @@ -193,7 +194,7 @@ bool PlotView::viewportEvent(QEvent *event) { } // Handle parent eveents - QAbstractScrollArea::viewportEvent(event); + QGraphicsView::viewportEvent(event); // Pass mouse events to individual plot objects if (event->type() == QEvent::MouseButtonPress || diff --git a/plotview.h b/plotview.h index 7ff969f..2631d8f 100644 --- a/plotview.h +++ b/plotview.h @@ -19,7 +19,7 @@ #pragma once -#include +#include #include #include "cursors.h" @@ -29,7 +29,7 @@ #include "spectrogramplot.h" #include "traceplot.h" -class PlotView : public QAbstractScrollArea, Subscriber +class PlotView : public QGraphicsView, Subscriber { Q_OBJECT