| 378 | } |
| 379 | |
| 380 | void MainWindowPrivate::clearArea() |
| 381 | { |
| 382 | qCDebug(SUBLIME) << "clearing area" << area; |
| 383 | |
| 384 | //reparent tool view widgets to nullptr to prevent their deletion together with dockwidgets |
| 385 | for (View* view : std::as_const(area->toolViews())) { |
| 386 | // FIXME should we really delete here?? |
| 387 | bool nonDestructive = true; |
| 388 | idealController->removeView(view, nonDestructive); |
| 389 | } |
| 390 | |
| 391 | docks.clear(); |
| 392 | |
| 393 | //reparent all view widgets to 0 to prevent their deletion together with central |
| 394 | //widget. this reparenting is necessary when switching areas inside the same mainwindow |
| 395 | const auto views = area->views(); |
| 396 | for (const auto* const view : views) { |
| 397 | if (auto* const widget = view->widget()) { |
| 398 | widget->setParent(nullptr); |
| 399 | } |
| 400 | } |
| 401 | cleanCentralWidget(); |
| 402 | m_mainWindow->setActiveView(nullptr); |
| 403 | m_indexSplitters.clear(); |
| 404 | area = nullptr; |
| 405 | viewContainers.clear(); |
| 406 | } |
| 407 | |
| 408 | void MainWindowPrivate::cleanCentralWidget() |
| 409 | { |
nothing calls this directly
no test coverage detected