ViewPtr ViewCollectionWidgetMixed::addView(View::Type type, LayoutRegion region) { ViewPtr view; mTotalRegion = merge(region, mTotalRegion); if (type==View::VIEW_3D) { ViewWidget* overlay = this->mViewCacheOverlay->retrieveView(); overlay->getView()->setType(type); overlay->show(); mOverlays.push_back(overlay); view = overlay->getView(); this->addWidgetToLayout(mLayout, overlay, region); } else { mBaseRegion = merge(region, mBaseRegion); view = mBaseLayout->addView(type, region); // re-add the base widget with updated position in grid this->addWidgetToLayout(mLayout, mBaseLayout, mBaseRegion); } view_utils::setStretchFactors(mLayout, mTotalRegion, 1); return view; }
ViewPtr LayoutWidgetUsingViewWidgets::addView(View::Type type, LayoutRegion region) { ViewWidget* view = this->retrieveView(type); view->getView()->setType(type); mLayout->addWidget(view, region.pos.row, region.pos.col, region.span.row, region.span.col); view_utils::setStretchFactors(mLayout, region, 1); view->show(); mViews.push_back(view); return view->getView(); }