============================================================================
| 300 | |
| 301 | //============================================================================ |
| 302 | bool DockWidgetTabPrivate::startFloating(eDragState DraggingState) |
| 303 | { |
| 304 | auto dockContainer = DockWidget->dockContainer(); |
| 305 | ADS_PRINT("isFloating " << dockContainer->isFloating()); |
| 306 | ADS_PRINT("areaCount " << dockContainer->dockAreaCount()); |
| 307 | ADS_PRINT("widgetCount " << DockWidget->dockAreaWidget()->dockWidgetsCount()); |
| 308 | // if this is the last dock widget inside of this floating widget, |
| 309 | // then it does not make any sense, to make it floating because |
| 310 | // it is already floating |
| 311 | if (dockContainer->isFloating() |
| 312 | && (dockContainer->visibleDockAreaCount() == 1) |
| 313 | && (DockWidget->dockAreaWidget()->dockWidgetsCount() == 1)) |
| 314 | { |
| 315 | return false; |
| 316 | } |
| 317 | |
| 318 | ADS_PRINT("startFloating"); |
| 319 | DragState = DraggingState; |
| 320 | IFloatingWidget* FloatingWidget = nullptr; |
| 321 | bool CreateContainer = (DraggingFloatingWidget != DraggingState); |
| 322 | |
| 323 | // If section widget has multiple tabs, we take only one tab |
| 324 | // If it has only one single tab, we can move the complete |
| 325 | // dock area into floating widget |
| 326 | QSize Size; |
| 327 | if (DockArea->dockWidgetsCount() > 1) |
| 328 | { |
| 329 | FloatingWidget = createFloatingWidget(DockWidget, CreateContainer); |
| 330 | Size = DockWidget->size(); |
| 331 | } |
| 332 | else |
| 333 | { |
| 334 | FloatingWidget = createFloatingWidget(DockArea, CreateContainer); |
| 335 | Size = DockArea->size(); |
| 336 | } |
| 337 | |
| 338 | if (DraggingFloatingWidget == DraggingState) |
| 339 | { |
| 340 | FloatingWidget->startFloating(DragStartMousePosition, Size, DraggingFloatingWidget, _this); |
| 341 | auto DockManager = DockWidget->dockManager(); |
| 342 | auto Overlay = DockManager->containerOverlay(); |
| 343 | Overlay->setAllowedAreas(OuterDockAreas); |
| 344 | this->FloatingWidget = FloatingWidget; |
| 345 | qApp->postEvent(DockWidget, new QEvent((QEvent::Type)internal::DockedWidgetDragStartEvent)); |
| 346 | } |
| 347 | else |
| 348 | { |
| 349 | FloatingWidget->startFloating(DragStartMousePosition, Size, DraggingInactive, nullptr); |
| 350 | } |
| 351 | |
| 352 | return true; |
| 353 | } |
| 354 | |
| 355 | |
| 356 | //============================================================================ |
no test coverage detected