[vtkusers] Trouble with QVTK

Clinton Stimpson clinton at elemtech.com
Thu May 21 10:16:59 EDT 2009


There are examples in VTK/Examples/GUI/Qt.
Both SimpleView/ and Events/ have designer .ui files.

Clint

Joshua Pedrick wrote:
> Does anyone have a working example using QVTK + QtDesigner on Linux 
> that I could try to compare?
>
> On Tue, May 12, 2009 at 1:16 PM, Joshua Pedrick <jpedrick at gmail.com 
> <mailto:jpedrick at gmail.com>> wrote:
>
>     Hello again Leo,
>          Here's my code once again, but distilled and reordered a bit.
>     I removed all the Deletes and whatnot. I'm still not getting
>     anything but the gradient background. Any clues?
>          I downloaded and compiled VTK-5.4 with QVTK, using Qt version
>     4.5.1 from Qt SDK 2009.02. Still no luck. So the latest VTK from
>     CVS and version 5.4 aren't working. I can't be the only one using
>     QVTK. I am not using cmake to build my project, could this be the
>     problem? Are there some compiler flags I need to set for QVTK to
>     work?
>
>
>          Regards,
>            -Joshua
>
>     void MainWindow::SetupScene()
>     {
>         QVTKWidget* qvtkwidget = ui.qvtkWidget;
>
>         qvtkwidget->GetRenderWindow()->DoubleBufferOff();
>
>
>         //Put cone in window
>         {
>             vtkConeSource *cone = vtkConeSource::New();
>
>             //Create Cone Mapper.
>             vtkPolyDataMapper *coneMapper = vtkPolyDataMapper::New();
>             coneMapper->SetInputConnection(cone->GetOutputPort());
>
>             //Create Cone Actor
>
>             vtkActor *coneActor = vtkActor::New();
>             coneActor->SetMapper(coneMapper);
>
>             //Create Cone Renderer
>             vtkRenderer *ren = vtkRenderer::New();
>             ren->SetBackground(0,0,0);
>             ren->SetBackground2(1,1,1);
>             ren->GradientBackgroundOn();
>
>             ren->AddActor(coneActor);
>
>             qvtkwidget->GetRenderWindow()->AddRenderer(ren);
>
>         }
>
>     }
>
>     2009/5/12 L.J. van Ruijven <L.J.vanRuijven at amc.uva.nl
>     <mailto:L.J.vanRuijven at amc.uva.nl>>
>
>         Hi Joshua,
>
>         I allready deleted your first mail, so I cannot check the code
>         again, but I think here the background renderer is added. So
>         that one is really drawn in the render window.
>         But if I remember well, you created the pipeline for the cone
>         in a separate fragment. And in the end of this fragment you
>         deleted the cone renderer, but you never added it to the
>         render window.
>
>         regards,
>
>         Leo.
>
>
>         ----- Original Message -----
>         From: Joshua Pedrick <jpedrick at gmail.com
>         <mailto:jpedrick at gmail.com>>
>         Date: Tuesday, May 12, 2009 3:36 pm
>         Subject: Re: Trouble with QVTK
>         To: vtkusers at vtk.org <mailto:vtkusers at vtk.org>
>         Cc: "L.J. van Ruijven" <L.J.vanRuijven at amc.uva.nl
>         <mailto:L.J.vanRuijven at amc.uva.nl>>
>
>
>         > L.J. I think I do this in MainWindow::SetupScene() at the
>         very end:
>         >
>         >                 qvtkwidget->GetRenderWindow()->AddRenderer(ren);
>         >                 qvtkwidget->GetRenderWindow()->BordersOn();
>         >
>         >                 ren->Delete();
>         >
>         >  Is this not the correct way to add a renderer? I do get the
>         lovely gradient
>         >  background I applied to the renderer, but no actors. The
>         gradient background
>         >  makes me think the renderer is properly connected to the
>         render window.
>         >
>         >  I'm going to compile the stable version of VTK today and
>         see how it goes.
>         >  I'm really suspecting there is a bug in the CVS QVTK.
>         >
>         >               Regards
>         >                    -Joshua
>         >
>         >  2009/5/12 L.J. van Ruijven <L.J.vanRuijven at amc.uva.nl
>         <mailto:L.J.vanRuijven at amc.uva.nl>>
>         >
>         >  > Hi Joshua,
>         >  >
>         >  > I think you forgot to connect the renderer to the
>         renderwindow. Somewhere
>         >  > you should add the statement renWin->AddRenderer(ren).
>         >  >
>         >  > regards,
>         >  >
>         >  > Leo
>         >  >
>         >  >
>         >  >
>         >
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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 VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>   





More information about the vtkusers mailing list