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

Method addWidget

kdevplatform/sublime/container.cpp:464–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464void Container::addWidget(View* view, QWidget* widget, int position)
465{
466 Q_D(Container);
467
468 Q_ASSERT(view);
469 Q_ASSERT(widget);
470 Q_ASSERT(widget == view->widget());
471 Q_ASSERT(!hasWidget(widget));
472
473 int idx = 0;
474 if (position != -1)
475 {
476 idx = d->stack->insertWidget(position, widget);
477 }
478 else
479 idx = d->stack->addWidget(widget);
480 d->tabBar->insertTab(idx, view->document()->statusIcon(), view->document()->title());
481 Q_ASSERT(view);
482 d->viewForWidget[widget] = view;
483
484 // Update document list context menu. This has to be called before
485 // setCurrentWidget, because we call the status icon and title update slots
486 // from there, which in turn require view to be present in the document list menu.
487 d->insertIntoDocumentListMenu(view);
488
489 setCurrentWidget(d->stack->currentWidget());
490
491 // This fixes a strange layouting bug, that could be reproduced like this: Open a few files in KDevelop, activate the rightmost tab.
492 // Then temporarily switch to another area, and then switch back. After that, the tab-bar was gone.
493 // The problem could only be fixed by closing/opening another view.
494 d->tabBar->setMinimumHeight(d->tabBar->sizeHint().height());
495
496 connect(view, &View::statusChanged, this, &Container::statusChanged);
497 connect(view->document(), &Document::statusIconChanged, this, &Container::statusIconChanged);
498 connect(view->document(), &Document::titleChanged, this, &Container::documentTitleChanged);
499}
500
501void Container::statusChanged(Sublime::View* view)
502{

Callers 15

BreakpointDetailsMethod · 0.45
BreakpointWidgetMethod · 0.45
VariableWidgetMethod · 0.45
VariableToolTipMethod · 0.45
FramestackWidgetMethod · 0.45
PathMappingsWidgetMethod · 0.45
OpenProjectPageMethod · 0.45
childEventMethod · 0.45
createFunction · 0.45
adjustPluginPageAdapterFunction · 0.45
setSourceWidgetMethod · 0.45
openProjectMethod · 0.45

Calls 7

statusIconMethod · 0.80
widgetMethod · 0.45
documentMethod · 0.45
titleMethod · 0.45
currentWidgetMethod · 0.45
sizeHintMethod · 0.45

Tested by 3

mainFunction · 0.36
TestViewMethod · 0.36