diff options
author | Manuel Schneider | 2014-04-25 17:24:32 +0200 |
---|---|---|
committer | Manuel Schneider | 2014-04-25 17:24:32 +0200 |
commit | 346aaf9a63bca22a42d112397c1a0de49e80384d (patch) | |
tree | f7959b45fc556454b8babb72d6596adf6a7dd913 /src/server/connectionframe | |
parent | Thrown out redundant slots. (diff) | |
download | pvs2-346aaf9a63bca22a42d112397c1a0de49e80384d.tar.gz pvs2-346aaf9a63bca22a42d112397c1a0de49e80384d.tar.xz pvs2-346aaf9a63bca22a42d112397c1a0de49e80384d.zip |
recognize a dragmove only if the distance is larger than 40 px
Diffstat (limited to 'src/server/connectionframe')
-rw-r--r-- | src/server/connectionframe/connectionframe.cpp | 23 | ||||
-rw-r--r-- | src/server/connectionframe/connectionframe.h | 2 |
2 files changed, 15 insertions, 10 deletions
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); |