34 #include <QGridLayout>
38 #include "vtkRenderWindow.h"
48 mLayout =
new QGridLayout(
this);
49 this->setLayout(mLayout);
52 this->initBaseLayout();
59 void ViewCollectionWidgetMixed::initBaseLayout()
62 this->addWidgetToLayout(mLayout, mBaseLayout,
LayoutRegion(0,0));
73 mTotalRegion =
merge(region, mTotalRegion);
77 ViewWidget* overlay = this->mViewCacheOverlay->retrieveView();
78 overlay->
getView()->setType(type);
80 mOverlays.push_back(overlay);
82 this->addWidgetToLayout(mLayout, overlay, region);
86 mBaseRegion =
merge(region, mBaseRegion);
87 view = mBaseLayout->
addView(type, region);
89 this->addWidgetToLayout(mLayout, mBaseLayout, mBaseRegion);
96 void ViewCollectionWidgetMixed::addWidgetToLayout(QGridLayout* layout, QWidget* widget,
LayoutRegion region)
98 layout->addWidget(widget,
105 mViewCacheOverlay->clearUsedViews();
107 for (
unsigned i=0; i<mOverlays.size(); ++i)
109 mOverlays[i]->hide();
110 mLayout->removeWidget(mOverlays[i]);
115 mLayout->removeWidget(mBaseLayout);
119 this->addWidgetToLayout(mLayout, mBaseLayout,
LayoutRegion(0,0));
127 for (
unsigned i=0; i<mOverlays.size(); ++i)
135 for (
unsigned i=0; i<mOverlays.size(); ++i)
137 mOverlays[i]->render();
145 mLayout->setSpacing(val);
152 mLayout->setMargin(val);
157 return mLayout->spacing();
162 return mLayout->margin();
168 std::vector<ViewPtr> retval = mBaseLayout->
getViews();
169 for (
unsigned i=0; i<mOverlays.size(); ++i)
170 retval.push_back(mOverlays[i]->getView());
176 for (
unsigned i=0; i<mOverlays.size(); ++i)
178 if (mOverlays[i]->getView()==view)
180 QPoint p = mOverlays[i]->mapToGlobal(QPoint(0,0));
181 p = this->mapFromGlobal(p);
187 p = mBaseLayout->mapToGlobal(p);
188 p = this->mapFromGlobal(p);
LayoutPosition span
size of region
boost::shared_ptr< class View > ViewPtr
void setStretchFactors(QGridLayout *layout, LayoutRegion region, int stretchFactor)
LayoutPosition pos
start position of region
LayoutRegion merge(LayoutRegion a, LayoutRegion b)