File tree Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Expand file tree Collapse file tree 4 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 1515#include < QDebug>
1616#include < QBoxLayout>
1717#include < QMenu>
18+ #include < QApplication>
1819
1920#include " FloatingDockContainer.h"
2021#include " DockAreaWidget.h"
@@ -185,9 +186,10 @@ void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
185186 return ;
186187 }
187188
188- int DragDistanceY = qAbs (d->DragStartMousePos .y () - ev->pos ().y ());
189- int MinDragDistanceY = this ->height () / 2 ;
190- if (DragDistanceY >= MinDragDistanceY)
189+ /* int DragDistanceY = qAbs(d->DragStartMousePos.y() - ev->pos().y());
190+ int MinDragDistanceY = this->height() / 2;*/
191+ int DragDistance = (d->DragStartMousePos - ev->pos ()).manhattanLength ();
192+ if (DragDistance >= CDockManager::startDragDistance ())
191193 {
192194 qDebug () << " CTabsScrollArea::startFloating" ;
193195 startFloating (d->DragStartMousePos );
Original file line number Diff line number Diff line change 4444#include < QXmlStreamReader>
4545#include < QSettings>
4646#include < QMenu>
47+ #include < QApplication>
4748
4849#include " FloatingDockContainer.h"
4950#include " DockOverlay.h"
@@ -629,6 +630,13 @@ bool CDockManager::isRestoringState() const
629630 return d->RestoringState ;
630631}
631632
633+
634+ // ===========================================================================
635+ int CDockManager::startDragDistance ()
636+ {
637+ return QApplication::startDragDistance () * 1.5 ;
638+ }
639+
632640} // namespace ads
633641
634642// ---------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -270,6 +270,12 @@ class ADS_EXPORT CDockManager : public CDockContainerWidget
270270 */
271271 bool isRestoringState () const ;
272272
273+ /* *
274+ * The distance the user needs to move the mouse with the left button
275+ * hold down before a dock widget start floating
276+ */
277+ static int startDragDistance ();
278+
273279public slots:
274280 /* *
275281 * Opens the perspective with the given name.
Original file line number Diff line number Diff line change @@ -281,8 +281,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
281281
282282 // Maybe a fixed drag distance is better here ?
283283 int DragDistanceY = qAbs (d->DragStartMousePosition .y () - ev->pos ().y ());
284- int MinDragDistanceY = d->DockArea ->titleBarGeometry ().height () / 2 ;
285- if (DragDistanceY >= MinDragDistanceY)
284+ if (DragDistanceY >= CDockManager::startDragDistance ())
286285 {
287286 // If this is the last dock area in a dock container with only
288287 // one single dock widget it does not make sense to move it to a new
You can’t perform that action at this time.
0 commit comments