diff --git a/src/DockAreaTabBar.cpp b/src/DockAreaTabBar.cpp index 9b3df78..2c0d40c 100644 --- a/src/DockAreaTabBar.cpp +++ b/src/DockAreaTabBar.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "FloatingDockContainer.h" #include "DockAreaWidget.h" @@ -185,9 +186,10 @@ void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev) return; } - int DragDistanceY = qAbs(d->DragStartMousePos.y() - ev->pos().y()); - int MinDragDistanceY = this->height() / 2; - if (DragDistanceY >= MinDragDistanceY) + /*int DragDistanceY = qAbs(d->DragStartMousePos.y() - ev->pos().y()); + int MinDragDistanceY = this->height() / 2;*/ + int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength(); + if (DragDistance >= CDockManager::startDragDistance()) { qDebug() << "CTabsScrollArea::startFloating"; startFloating(d->DragStartMousePos); diff --git a/src/DockManager.cpp b/src/DockManager.cpp index b8c5acd..eb668b5 100644 --- a/src/DockManager.cpp +++ b/src/DockManager.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "FloatingDockContainer.h" #include "DockOverlay.h" @@ -629,6 +630,13 @@ bool CDockManager::isRestoringState() const return d->RestoringState; } + +//=========================================================================== +int CDockManager::startDragDistance() +{ + return QApplication::startDragDistance() * 1.5; +} + } // namespace ads //--------------------------------------------------------------------------- diff --git a/src/DockManager.h b/src/DockManager.h index 22a26f0..f335a03 100644 --- a/src/DockManager.h +++ b/src/DockManager.h @@ -270,6 +270,12 @@ public: */ bool isRestoringState() const; + /** + * The distance the user needs to move the mouse with the left button + * hold down before a dock widget start floating + */ + static int startDragDistance(); + public slots: /** * Opens the perspective with the given name. diff --git a/src/DockWidgetTab.cpp b/src/DockWidgetTab.cpp index e88ee98..74f1f63 100644 --- a/src/DockWidgetTab.cpp +++ b/src/DockWidgetTab.cpp @@ -281,8 +281,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev) // Maybe a fixed drag distance is better here ? int DragDistanceY = qAbs(d->DragStartMousePosition.y() - ev->pos().y()); - int MinDragDistanceY = d->DockArea->titleBarGeometry().height() / 2; - if (DragDistanceY >= MinDragDistanceY) + if (DragDistanceY >= CDockManager::startDragDistance()) { // If this is the last dock area in a dock container with only // one single dock widget it does not make sense to move it to a new