[vtkusers] VTK and Qt 4.0.1 using QVTKWidget
André Huisman
ahuisman at cs.uu.nl
Wed Sep 7 09:15:58 EDT 2005
Dear vtk and Qt-users,
Until now I spend lots of time setting up my application using Qt 4.0.(1)
in combination with ITK and VTK. I'm using the ITK export filter and the
VTK import filter, everything works fine. I can create a vtkImageViewer
object and I'm able to see the read image. I can also create an ImageActor
and add that to the renderer, than I get an OpenGL window containing the
image. No problem. But now I want the window to be a subwindow (mdi child)
of my Qt application by subclassing QVTKWidget, everything works fine
using the following code (when I use this code in a class that is not a
subclass of QVTKWidget it works):
vtkImageActor* actor = vtkImageActor::New();
vtkImageData* data = importer->import();
actor->SetInput(data);
data->SetScalarTypeToUnsignedChar();
vtkRenderer* renderer = vtkRenderer::New();
vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(this->GetRenderWindow());
renderer->AddActor(actor);
renderer->SetBackground(0.4392, 0.5020, 0.5647);
this->GetRenderWindow()->AddRenderer(renderer);
iren->Start();
renderer->Render();
show();
Can someone please help me? I'm using the Microsoft Visual C++ 7.1
compiler, VTK CVS version (approx. 5 days old).
Thank you very much in advance!
André Huisman
Dep. of pathology, University Medical Center Utrecht, the Netherlands
More information about the vtkusers
mailing list