MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / closeSplitterAndMoveOtherSplitToParent

Method closeSplitterAndMoveOtherSplitToParent

Gui/TabWidget.cpp:576–624  ·  view source on GitHub ↗

* @brief Deletes container and move the other split (the one that is not this) to the parent of container. * If the parent container is a splitter then we will insert it instead of the container. * Otherwise if the parent is a floating window we will insert it as embedded widget of the window. **/

Source from the content-addressed store, hash-verified

574 * Otherwise if the parent is a floating window we will insert it as embedded widget of the window.
575 **/
576void
577TabWidget::closeSplitterAndMoveOtherSplitToParent(Splitter* container)
578{
579 QWidget* otherSplit = 0;
580
581 /*identifying the other split*/
582 getOtherSplitWidget(container, this, otherSplit);
583
584 Splitter* parentSplitter = dynamic_cast<Splitter*>( container->parentWidget() );
585 QWidget* parent = container->parentWidget();
586 FloatingWidget* parentWindow = 0;
587 while (parent) {
588 parentWindow = dynamic_cast<FloatingWidget*>(parent);
589 if (parentWindow) {
590 break;
591 }
592 parent = parent->parentWidget();
593 }
594
595 assert(parentSplitter || parentWindow);
596
597 if (parentSplitter) {
598 QList<int> mainContainerSizes = parentSplitter->sizes();
599
600 /*Removing the splitter container from its parent*/
601 int containerIndexInParentSplitter = parentSplitter->indexOf(container);
602 parentSplitter->removeChild_mt_safe(container);
603
604 /*moving the other split to the mainContainer*/
605 if (otherSplit) {
606 parentSplitter->insertChild_mt_safe(containerIndexInParentSplitter, otherSplit);
607 otherSplit->setVisible(true);
608 }
609
610 /*restore the main container sizes*/
611 parentSplitter->setSizes_mt_safe(mainContainerSizes);
612 } else {
613 if (otherSplit) {
614 assert(parentWindow);
615 parentWindow->removeEmbeddedWidget();
616 parentWindow->setWidget(otherSplit);
617 }
618 }
619
620 /*Remove the container from everywhere*/
621 _imp->gui->unregisterSplitter(container);
622 // container->setParent(NULL);
623 container->deleteLater();
624}
625
626void
627TabWidget::closePane()

Callers

nothing calls this directly

Calls 9

getOtherSplitWidgetFunction · 0.85
sizesMethod · 0.80
removeChild_mt_safeMethod · 0.80
insertChild_mt_safeMethod · 0.80
setSizes_mt_safeMethod · 0.80
removeEmbeddedWidgetMethod · 0.80
setWidgetMethod · 0.80
unregisterSplitterMethod · 0.80
setVisibleMethod · 0.45

Tested by

no test coverage detected