[vtkusers] InfoVis: vtkGraphLayoutView in QVTK Widget
Jeff Baumes
jeff.baumes at kitware.com
Mon Jun 29 10:57:16 EDT 2009
Try the following, it should work. This is the result of some major
view/representation refactoring that has taken place in VTK CVS. I'd like to
avoid the need for the SetInteractor() call in the future, but currently
it's necessary to avoid the popout on some systems.
vtkRenderViewPtr->SetInteractor(qvtkWidget->GetInteractor());
qvtkWidget->SetRenderWindow(vtkRenderViewPtr->GetRenderWindow());
If you're interested in some discussion of the refactoring, look here
https://www.kitware.com/InfovisWiki/index.php/View_Representation_Refactoring
Jeff
On Mon, Jun 29, 2009 at 10:44 AM, Eric E. Monson <emonson at cs.duke.edu>wrote:
> Hey again,
>
> I just tried to follow the Cxx EasyView and it still opens another render
> window with all of my graph stuff in it, and the QVTK widget just shows
> garbage from the last application that I ran (which here happens to be
> another PyQt4 app showing a cylinder that worked just fine -- screen shot
> attached).
>
> class SimpleView(QtGui.QMainWindow):
>
> def __init__(self, parent = None):
>
> QtGui.QMainWindow.__init__(self, parent)
> self.ui = Ui_MainWindow()
> self.ui.setupUi(self)
>
> self.view = vtk.vtkGraphLayoutView()
> self.ui.vtkWidget.SetRenderWindow(self.view.GetRenderWindow())
>
>
> I'm using OS X 10.5.7, Qt 4.4.3, VTK CVS from June 18th, Python 2.5.
>
> Thanks,
> -Eric
>
>
>
>
>
> On Jun 29, 2009, at 9:59 AM, Eric E. Monson wrote:
>
> Hello,
>>
>> I have a little Python/PyQt4 app that I made about six months ago to view
>> graphs using the Titan classes. A vtkGraphLayoutView should show up in a
>> QVTK Widget which I placed using Designer, but now with CVS VTK I get a
>> separate RenderWindow popping up showing my graph...
>>
>> vtkGraphLayoutView used to have a SetupRenderWindow() method, so I used to
>> set things up by:
>>
>> QtGui.QMainWindow.__init__(self, parent)
>> self.ui = Ui_MainWindow()
>> self.ui.setupUi(self)
>>
>> self.ren = vtk.vtkRenderer()
>> self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
>>
>> [...]
>>
>> self.view = vtk.vtkGraphLayoutView()
>> win = self.ren.GetRenderWindow()
>> self.view.SetupRenderWindow(win)
>>
>> Now if I just take out the view.SetupRenderWindow(win) call, I get a
>> separate RenderWindow popping up and the QVTK widget is all black. I tried
>> reordering the calls to something like this:
>>
>> self.view = vtk.vtkGraphLayoutView()
>> self.ren = self.view.GetRenderer()
>> self.ui.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
>> self.win = self.ui.vtkWidget.GetRenderWindow()
>>
>> Then the graph shows up in BOTH the extra window and my QVTK Widget.
>>
>> I know I'm just ignorant about the correct method -- can anybody help me
>> set up a vtkGraphLayoutView in a QVTK Widget properly?
>>
>> Thanks a lot,
>> -Eric
>>
>> ------------------------------------------------------
>> Eric E Monson
>> Duke Visualization Technology Group
>>
>>
>> _______________________________________________
>> 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
>>
>
>
> _______________________________________________
> 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
>
>
--
Jeff Baumes, Ph.D.
R&D Engineer, Kitware Inc.
(518) 881-4932
jeff.baumes at kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090629/674654c5/attachment.htm>
More information about the vtkusers
mailing list