| 425 | } |
| 426 | |
| 427 | void IdealController::addView(Qt::DockWidgetArea area, View* view) |
| 428 | { |
| 429 | auto *dock = new IdealDockWidget(this, m_mainWindow); |
| 430 | dock->setView(view); |
| 431 | |
| 432 | const auto* const document = view->document(); |
| 433 | const auto documentTitle = document->title(); |
| 434 | dock->setWindowTitle(documentTitle); |
| 435 | |
| 436 | // QMainWindow::saveState() and QMainWindow::restoreState() use the objectName property to |
| 437 | // identify a QDockWidget. Make the name of the dock widget's sublime area part of the object name |
| 438 | // in order to support differing locations and visibilities of dock widgets in different areas. |
| 439 | auto* const sublimeArea = m_mainWindow->area(); |
| 440 | Q_ASSERT(sublimeArea); |
| 441 | dock->setArea(sublimeArea); |
| 442 | dock->setObjectName(document->documentSpecifier() + QLatin1Char('_') + sublimeArea->objectName()); |
| 443 | |
| 444 | qCDebug(SUBLIME) << "creating dock widget" << PrintDockWidget{dock} << "in" << area; |
| 445 | |
| 446 | KAcceleratorManager::setNoAccel(dock); |
| 447 | |
| 448 | const auto [viewWidget, justCreatedWidget] = m_toolViewWidgetCache->prepareViewWidget(*view, dock); |
| 449 | auto* const widgetForDockWidget = justCreatedWidget |
| 450 | ? setUpWidgetForDockWidget(*m_mainWindow, *view, viewWidget, documentTitle) |
| 451 | : existentWidgetForDockWidget(*m_mainWindow, viewWidget); |
| 452 | |
| 453 | dock->setWidget(widgetForDockWidget); |
| 454 | dock->setWindowIcon(viewWidget->windowIcon()); |
| 455 | dock->setFocusProxy(dock->widget()); |
| 456 | |
| 457 | addBarWidgetAction(area, dock, view); |
| 458 | |
| 459 | connect(dock, &IdealDockWidget::dockLocationChanged, this, &IdealController::dockLocationChanged); |
| 460 | connect(dock, &QDockWidget::topLevelChanged, this, &IdealController::dockTopLevelChanged); |
| 461 | |
| 462 | dock->hide(); |
| 463 | } |
| 464 | |
| 465 | void IdealController::addBarWidgetAction(Qt::DockWidgetArea area, IdealDockWidget* dock, View* view, bool checked) |
| 466 | { |
nothing calls this directly
no test coverage detected