From 346aaf9a63bca22a42d112397c1a0de49e80384d Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Fri, 25 Apr 2014 17:24:32 +0200 Subject: recognize a dragmove only if the distance is larger than 40 px --- src/server/connectionframe/connectionframe.cpp | 23 +++++++++++++---------- src/server/connectionframe/connectionframe.h | 2 ++ 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'src/server/connectionframe') diff --git a/src/server/connectionframe/connectionframe.cpp b/src/server/connectionframe/connectionframe.cpp index f5739ee..7d9376c 100644 --- a/src/server/connectionframe/connectionframe.cpp +++ b/src/server/connectionframe/connectionframe.cpp @@ -131,16 +131,19 @@ void ConnectionFrame::mouseReleaseEvent(QMouseEvent* event) event->accept(); if (event->button() == Qt::LeftButton) { - QApplication::setOverrideCursor(QCursor(Qt::OpenHandCursor)); - if (this->pos() != _previousPosition) { - qDebug("Moved"); - emit frameMoved(this); - } - else - { - qDebug("Clicked"); - emit clicked(this); - } + QApplication::setOverrideCursor(QCursor(Qt::OpenHandCursor)); + // Only recognize a move if the distance is larger than _startDragDistance + if ((this->pos() - _previousPosition).manhattanLength() > _startDragDistance ) + { + qDebug("Moved"); + emit frameMoved(this); + } + else + { + qDebug("Clicked"); + move(_previousPosition); + emit clicked(this); + } } } diff --git a/src/server/connectionframe/connectionframe.h b/src/server/connectionframe/connectionframe.h index 9898460..367810c 100644 --- a/src/server/connectionframe/connectionframe.h +++ b/src/server/connectionframe/connectionframe.h @@ -31,6 +31,8 @@ private: bool _selected; bool _isTutor; + static const int _startDragDistance = 40; + void showDefaultThumb(); void updateAppearance(); QLabel* addIcon(const QIcon* icon); -- cgit v1.2.3-55-g7522