| 474 | } |
| 475 | |
| 476 | void IdealController::dockLocationChanged(Qt::DockWidgetArea area) |
| 477 | { |
| 478 | auto* const dock = qobject_cast<IdealDockWidget*>(sender()); |
| 479 | Q_ASSERT(dock); |
| 480 | |
| 481 | // Seems since Qt 5.13 the signal QDockWidget::dockLocationChanged is emitted also when the dock changes |
| 482 | // to be floating, with area = Qt::NoDockWidgetArea. |
| 483 | if (area == Qt::NoDockWidgetArea) { |
| 484 | qCDebug(SUBLIME) << "dock widget" << PrintDockWidget{dock} << "location changed to no area"; |
| 485 | return; // this case is handled in dockTopLevelChanged(true), so nothing to do here |
| 486 | } |
| 487 | |
| 488 | const auto previousArea = dock->dockWidgetArea(); |
| 489 | |
| 490 | if (previousArea == area) { |
| 491 | // this event can happen even when dock changes its location within the same area |
| 492 | // usecases: |
| 493 | // 1) user drags to the same area |
| 494 | // 2) user rearranges tool views inside the same area |
| 495 | // 3) state restoration shows the dock widget |
| 496 | qCDebug(SUBLIME) << "dock widget" << PrintDockWidget{dock} << "remains in" << area; |
| 497 | return; |
| 498 | } |
| 499 | |
| 500 | qCDebug(SUBLIME) << "dock widget" << PrintDockWidget{dock} << "location changed from" << previousArea << "to" |
| 501 | << area; |
| 502 | |
| 503 | auto* const view = dock->view(); |
| 504 | auto* const action = m_view_to_action.value(view); |
| 505 | const auto isVisible = dock->isVisible(); |
| 506 | |
| 507 | barForDockArea(previousArea)->removeAction(action); |
| 508 | setShowDockStatus(previousArea, false); |
| 509 | |
| 510 | addBarWidgetAction(area, dock, view, isVisible); |
| 511 | |
| 512 | m_mainWindow->area()->setToolViewPosition(view, dockAreaToPosition(area)); |
| 513 | |
| 514 | if (!isVisible) { |
| 515 | return; |
| 516 | } |
| 517 | |
| 518 | setShowDockStatus(area, true); |
| 519 | |
| 520 | // When the user moves a tool view via the Tool View Position submenu of its context menu, the dock widget |
| 521 | // never becomes floating between the two dock widget areas. In this case, dockTopLevelChanged() |
| 522 | // is not invoked and the moved tool view does not receive the focus. So focus it here. |
| 523 | dock->setFocus(Qt::ShortcutFocusReason); |
| 524 | } |
| 525 | |
| 526 | void IdealController::dockTopLevelChanged(bool topLevel) |
| 527 | { |
nothing calls this directly
no test coverage detected