[vtkusers] use QVTKWidget
David Doria
daviddoria at gmail.com
Wed May 16 16:59:04 EDT 2012
On Wed, May 16, 2012 at 4:54 PM, Massi <Massinissa.Bandou at usherbrooke.ca> wrote:
> Not exactly
> But here is my code, I don't know why it shouldn't work
>
> int main(int argc, char *argv[]) {
>
> QApplication app(argc, argv);
> CoregistrationForm form;
> //********************************Get
> input*********************************
> vtkJPEGReader *jpegReader = vtkJPEGReader::New();
>
> jpegReader->SetFileName("/Users/Massi/Desktop/bin_myProject/Release/test.jpg");
> jpegReader->Update();
> vtkImageMapper *imageMapper =vtkImageMapper::New();
> imageMapper->SetInput(jpegReader->GetOutput());
> imageMapper->GetInput();
>
> vtkImageActor *mapActor= vtkImageActor::New();
> mapActor->SetInput(imageMapper->GetInput());
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
> renderer->AddActor(mapActor);
>
> form.widget.qvtkWidget->GetRenderWindow()->AddRenderer(renderer);
> form.show();
> return app.exec();
> }
>
> Massi
I'm assuming you can't create the renderer before you create the Qt
"context". You'll see in the example that everything is done inside
the Qt widget/class, whose drawing is basically delayed until Qt is
ready for it. I always suggest trying the example as-is first, so you
can then see when it breaks.
David
More information about the vtkusers
mailing list