<pre><font size="2"><span style="font-family: tahoma,sans-serif;">Hi<br style="font-family: tahoma,sans-serif;"><br style="font-family: tahoma,sans-serif;"><span style="font-family: tahoma,sans-serif;"> I tried to use the recommended method below in my ParaView plugin:<br>
<br><br><br> // Get Application Core<br> pqApplicationCore* core = pqApplicationCore::instance();<br><br> // Get Object Builder to create new Views, Server etc<br> pqObjectBuilder* builder = core->getObjectBuilder(); <br>
<br> // Get the Server Manager Model so that we can get current server<br><br> pqServerManagerModel* serverManager = core->getServerManagerModel();<br> <br> if (serverManager->getNumberOfItems<pqServer*>()== 1) // Assuming that there is only 1 server<br>
<br> {<br>         pqServer* server = serverManager->getItemAtIndex<pqServer*>(0); <br><br>         if (serverManager->getNumberOfItems<pqView*> () == 1) // Assuming that there is only 1 view created<br>         {<br>                 pqView* view1 = serverManager->getItemAtIndex<pqView*>(0);<br>
<br>                 <br>                 // Get QWidget from first view <br><br>                 QWidget* viewWidget = view1->getWidget();<br>                 //Create GridLayout Widget from first view's widget<br>                 QGridLayout* gl = new QGridLayout(viewWidget);<br>
<br> //create second view<br><br>                 pqRenderView* view2 = qobject_cast<pqRenderView*>(<br>         builder->createView(pqRenderView::renderViewType(), server));<br> //Add second view's widget to gridlayout<br>
<br><br>                 gl->addWidget(view2->getWidget(),1,1);<br><br>                 //Create third view<br>                 <br> //create third view<br>                 pqRenderView* view3 = qobject_cast<pqRenderView*>(<br>         builder->createView(pqRenderView::renderViewType(), server));<br>
<br><br> //Add third view's widget to gridlayout<br>         gl->addWidget(view3->getWidget(),2,2);<br>         }<br> }<br><br>The debugger fails at<br></span></span></font><font size="2"><span style="font-family: tahoma,sans-serif;"><span style="font-family: tahoma,sans-serif;">pqRenderView* view3 = qobject_cast<pqRenderView*>(<br>
         builder->createView(pqRenderView::renderViewType(), server));</span></span></font><br><font size="2"><span style="font-family: tahoma,sans-serif;"><span style="font-family: tahoma,sans-serif;"><br>pqObjectBuilder.cxx : pxm->RegisterProxy("views", name.toAscii().data(), proxy);<br>
qwidget.h: inline QSize QWidget::size() const { return data->crect.size(); }<br><br>because data is null. <br> </span></span></font><font size="2"><span style="font-family: tahoma,sans-serif;"><span style="font-family: tahoma,sans-serif;"><br>
<br>name.toAscii is "RenderView3". <br><br>Can someone let me know what I mess up in the code? Thanks.<br></span><br></span><span style="font-family: tahoma,sans-serif;"><i> </i></span><font size="2"><i style="font-family: tahoma,sans-serif;"><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > On Thu, Mar 18, 2010 at 11:22 AM, Utkarsh Ayachit<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > <<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">utkarsh.ayachit at kitware.com</a>> wrote:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> Hello,<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> If you are creating a custom application which always has 4 render<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> windows, then I'd suggest not even using the pqViewManager.<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> Simply create the 4 views yourself and pack them into a QWidget using<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> a QGridLayout. For example, the following code can be used after a<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> server connection has been made to set up the 4 views.<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> QWidget* centralWidget = new QWidget();<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> mainWindow->setCentralWidget(centralWidget);<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> QGridLayout* gl = new QGridLayout(centralWidget);<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> for (int xx=0; xx < 2; xx++)<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> {<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> for (int yy=0; yy < 2; yy++)<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> {<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> pqRenderView* view = qobject_cast<pqRenderView*>(<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ob->createView(pqRenderView::renderViewType(), server));<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> gl->addWidget(view->getWidget(), yy, xx);<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> }<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> }<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> Utkarsh<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> On Thu, Mar 18, 2010 at 10:22 AM, Adebayo Olowoyeye<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> <<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">aolowoye at umail.iu.edu</a>> wrote:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Hi,<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > I am attempting to use the Clone2 CustomApplication example to write a<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > custom application in C++. The wiki documentation on Custom<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Applications<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > suggest using pqViewManager to control the view of the application.<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > I want to split the frame into four different windows, each with its<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> own<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > view. I am assuming the program starts with one frame and one view.<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> Is<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > this assumption correct?<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > I reference the pqViewManager with the following code:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > this->Internals->MultiViewManager<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > the active view (I'm guessing the only view at this point is):<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > pqView* view =<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > this->Internals->MultiViewManager->getActiveView();<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > This problem is there are no public methods to split the frame in<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > pqViewManager. It is possible to get the pqMultiViewFrame:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > pqMultiViewFrame * multiViewFrame =<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > this->Internals->MultiViewManager->getFrame(view);<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > I've tested this by:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > multiViewFrame->setTitle("HELLO WORLD!");<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > and it works, but I've tried multiple tries to get the frame to split<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > without success. Any insight will help.<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Thanks!<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > _______________________________________________<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Visit other Kitware open-source projects at<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Please keep messages on-topic and check the ParaView Wiki at:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > Follow this link to subscribe/unsubscribe:<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> > <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> >> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > _______________________________________________<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > Visit other Kitware open-source projects at<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > Please keep messages on-topic and check the ParaView Wiki at:<br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > Follow this link to subscribe/unsubscribe:<br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> > <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br></i><span style="font-family: tahoma,sans-serif;">></span><i style="font-family: tahoma,sans-serif;"> ><br>
</i><span style="font-family: tahoma,sans-serif;">></span></font></font><i><font size="2"><br></font></i></pre><br clear="all"><br clear="all"><br>-- <br>Alexis YL Chan <a href="http://alexisylchan.wordpress.com/" target="_blank"></a><br>