MCPcopy Create free account
hub / github.com/KDE/kdevelop / removeView

Method removeView

kdevplatform/sublime/idealcontroller.cpp:704–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

702}
703
704void 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
735void IdealController::toolViewRemoved(const Document* document)
736{

Callers

nothing calls this directly

Calls 6

dockWidgetAreaMethod · 0.80
removeActionMethod · 0.80
disuseMethod · 0.80
constFindMethod · 0.45
setParentMethod · 0.45

Tested by

no test coverage detected