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 15
15
#include < QDebug>
16
16
#include < QBoxLayout>
17
17
#include < QMenu>
18
+ #include < QApplication>
18
19
19
20
#include " FloatingDockContainer.h"
20
21
#include " DockAreaWidget.h"
@@ -185,9 +186,10 @@ void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
185
186
return ;
186
187
}
187
188
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 ())
191
193
{
192
194
qDebug () << " CTabsScrollArea::startFloating" ;
193
195
startFloating (d->DragStartMousePos );
Original file line number Diff line number Diff line change 44
44
#include < QXmlStreamReader>
45
45
#include < QSettings>
46
46
#include < QMenu>
47
+ #include < QApplication>
47
48
48
49
#include " FloatingDockContainer.h"
49
50
#include " DockOverlay.h"
@@ -629,6 +630,13 @@ bool CDockManager::isRestoringState() const
629
630
return d->RestoringState ;
630
631
}
631
632
633
+
634
+ // ===========================================================================
635
+ int CDockManager::startDragDistance ()
636
+ {
637
+ return QApplication::startDragDistance () * 1.5 ;
638
+ }
639
+
632
640
} // namespace ads
633
641
634
642
// ---------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -270,6 +270,12 @@ class ADS_EXPORT CDockManager : public CDockContainerWidget
270
270
*/
271
271
bool isRestoringState () const ;
272
272
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
+
273
279
public slots:
274
280
/* *
275
281
* 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)
281
281
282
282
// Maybe a fixed drag distance is better here ?
283
283
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 ())
286
285
{
287
286
// If this is the last dock area in a dock container with only
288
287
// 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