diff --git a/src/widgets/OverviewView.cpp b/src/widgets/OverviewView.cpp index 86f2f3a9..7483486c 100644 --- a/src/widgets/OverviewView.cpp +++ b/src/widgets/OverviewView.cpp @@ -74,11 +74,19 @@ void OverviewView::paintEvent(QPaintEvent *event) p.drawRect(rangeRect); } -void OverviewView::mousePressEvent(QMouseEvent *event) +bool OverviewView::mouseContainsRect(QMouseEvent *event) { if (rangeRect.contains(event->pos())) { mouseActive = true; initialDiff = QPointF(event->localPos().x() - rangeRect.x(), event->localPos().y() - rangeRect.y()); + return true; + } + return false; +} + +void OverviewView::mousePressEvent(QMouseEvent *event) +{ + if (mouseContainsRect(event)) { return; } qreal w = rangeRect.width(); @@ -88,7 +96,7 @@ void OverviewView::mousePressEvent(QMouseEvent *event) rangeRect = QRectF(x, y, w, h); viewport()->update(); emit mouseMoved(); - GraphView::mousePressEvent(event); + mouseContainsRect(event); } void OverviewView::mouseReleaseEvent(QMouseEvent *event) diff --git a/src/widgets/OverviewView.h b/src/widgets/OverviewView.h index 6c80770b..f89140cc 100644 --- a/src/widgets/OverviewView.h +++ b/src/widgets/OverviewView.h @@ -98,6 +98,11 @@ private: */ void adjustScale(); + /** + * @brief if the mouse is in the rect in Overview. + */ + bool mouseContainsRect(QMouseEvent *event); + /** * @brief base background color changing depending on the theme */