[Paraview] pqViewManager in Clone2

Utkarsh Ayachit utkarsh.ayachit at kitware.com
Wed Mar 9 11:18:27 EST 2011


If you can post your code on github or gitorious, it might be easier
to debug. It's not clear why you;d be getting that error.

Utkarsh

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


More information about the ParaView mailing list