[vtkusers] Axes marker not working as expected

Júlio Hoffimann julio.hoffimann at gmail.com
Fri Dec 19 17:50:01 EST 2014


Can anyone confirm QVTKWidget is not intended to be used as a local
variable (see code bellow)?

I'm getting a runtime error whenever the mouse cursor moves over the
QVTKWidget window.

-Júlio


>> > VTKViewer::VTKViewer(QWidget *parent) : QWidget(parent)
>> > {
>> >     QVTKWidget *qvtkwidget = new QVTKWidget;
>> >
>> >     auto axes = vtkSmartPointer<vtkAxesActor>::New();
>> >     axes->SetXAxisLabelText("x");
>> >     axes->SetYAxisLabelText("y");
>> >     axes->SetZAxisLabelText("z");
>> >
>> >     auto orientationMarker =
>> > vtkSmartPointer<vtkOrientationMarkerWidget>::New();
>> >     orientationMarker->SetInteractor(qvtkwidget->GetInteractor());
>> >     orientationMarker->SetOrientationMarker(axes);
>> >     orientationMarker->SetEnabled(1);
>> >
>> >     // sphere
>> >     auto sphereSource = vtkSmartPointer<vtkSphereSource>::New();
>> >     sphereSource->SetCenter(8, 8, 8);
>> >     sphereSource->SetRadius(5.0);
>> >     auto mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
>> >     mapper->SetInputConnection(sphereSource->GetOutputPort());
>> >     auto actor = vtkSmartPointer<vtkActor>::New();
>> >     actor->SetMapper(mapper);
>> >
>> >     auto renderer = vtkSmartPointer<vtkRenderer>::New();
>> >     renderer->AddActor(axes);
>> >     renderer->AddActor(actor);
>> >
>> >     vtkRenderWindow *renderWindow = qvtkwidget->GetRenderWindow();
>> >     renderWindow->AddRenderer(renderer);
>> > }
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141219/feb6d740/attachment.html>


More information about the vtkusers mailing list