| 702 | } |
| 703 | |
| 704 | void IdealController::removeView(View* view, bool nondestructive) |
| 705 | { |
| 706 | const auto viewIt = m_view_to_action.constFind(view); |
| 707 | Q_ASSERT(viewIt != m_view_to_action.cend()); |
| 708 | |
| 709 | auto* const action = *viewIt; |
| 710 | Q_ASSERT(action); |
| 711 | const auto [dock, toolView, viewWidget] = existentDockWidgetForView(view); |
| 712 | |
| 713 | /* Hide the view, first. This is a workaround -- if we |
| 714 | try to remove IdealDockWidget without this, then eventually |
| 715 | a call to IdealMainLayout::takeAt will be made, which |
| 716 | method asserts immediately. */ |
| 717 | action->setChecked(false); |
| 718 | |
| 719 | qCDebug(SUBLIME) << "destroying dock widget" << PrintDockWidget{dock} << "in" << dock->dockWidgetArea() |
| 720 | << (nondestructive ? "(nondestructive)" : ""); |
| 721 | |
| 722 | barForDockArea(dock->dockWidgetArea())->removeAction(action); |
| 723 | m_view_to_action.erase(viewIt); |
| 724 | |
| 725 | if (nondestructive || !m_toolViewWidgetCache->disuse(*view)) { |
| 726 | auto* const widgetToSave = toolView ? static_cast<QWidget*>(toolView) : viewWidget; |
| 727 | // Prevent destroying viewWidget and toolView along with their (grand)parent dock widget, and |
| 728 | // make sure that they are destroyed on KDevelop exit along with their new (grand)parent m_mainWindow. |
| 729 | widgetToSave->setParent(m_mainWindow); |
| 730 | } |
| 731 | |
| 732 | delete dock; |
| 733 | } |
| 734 | |
| 735 | void IdealController::toolViewRemoved(const Document* document) |
| 736 | { |
nothing calls this directly
no test coverage detected