@@ -123,7 +123,7 @@ struct DockWidgetTabPrivate
123123 * Returns true, if floating has been started and false if floating
124124 * is not possible for any reason
125125 */
126- bool startFloating ();
126+ bool startFloating (eDragState DraggingState = DraggingFloatingWidget );
127127
128128 /* *
129129 * Returns true if the given config flag is set
@@ -197,7 +197,7 @@ void DockWidgetTabPrivate::moveTab(QMouseEvent* ev)
197197
198198
199199// ============================================================================
200- bool DockWidgetTabPrivate::startFloating ()
200+ bool DockWidgetTabPrivate::startFloating (eDragState DraggingState )
201201{
202202 auto dockContainer = DockWidget->dockContainer ();
203203 qDebug () << " isFloating " << dockContainer->isFloating ();
@@ -214,7 +214,7 @@ bool DockWidgetTabPrivate::startFloating()
214214 }
215215
216216 qDebug () << " startFloating" ;
217- DragState = DraggingFloatingWidget ;
217+ DragState = DraggingState ;
218218 QSize Size = DockArea->size ();
219219 CFloatingDockContainer* FloatingWidget = nullptr ;
220220 if (DockArea->dockWidgetsCount () > 1 )
@@ -230,10 +230,13 @@ bool DockWidgetTabPrivate::startFloating()
230230 }
231231
232232 FloatingWidget->startFloating (DragStartMousePosition, Size);
233- auto Overlay = DockWidget->dockManager ()->containerOverlay ();
234- Overlay->setAllowedAreas (OuterDockAreas);
235- this ->FloatingWidget = FloatingWidget;
236- DockWidget->emitTopLevelChanged (true );
233+ if (DraggingFloatingWidget == DraggingState)
234+ {
235+ auto Overlay = DockWidget->dockManager ()->containerOverlay ();
236+ Overlay->setAllowedAreas (OuterDockAreas);
237+ this ->FloatingWidget = FloatingWidget;
238+ }
239+ DockWidget->emitTopLevelChanged (true );
237240 return true ;
238241}
239242
@@ -471,7 +474,7 @@ void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
471474 if (!d->DockArea ->dockContainer ()->isFloating () || d->DockArea ->dockWidgetsCount () > 1 )
472475 {
473476 d->DragStartMousePosition = event->pos ();
474- d->startFloating ();
477+ d->startFloating (DraggingInactive );
475478 }
476479
477480 Super::mouseDoubleClickEvent (event);
@@ -497,7 +500,7 @@ bool CDockWidgetTab::isClosable() const
497500void CDockWidgetTab::onDetachActionTriggered ()
498501{
499502 d->DragStartMousePosition = mapFromGlobal (QCursor::pos ());
500- d->startFloating ();
503+ d->startFloating (DraggingInactive );
501504}
502505
503506} // namespace ads
0 commit comments