<div dir="ltr">Dear all,<div><br></div><div>I'm trying to create a viewer widget with a QVTKWidget inside. For some reason the axes marker is not fixed in the bottom left of the scene. It moves together with the other objects (screenshot attached).</div><div><br></div><div>The code for the constructor is straightforward:</div><div><pre style="color:rgb(0,0,0);font-size:medium">VTKViewer<span style="color:rgb(128,0,128)">::</span>VTKViewer<span style="color:rgb(128,128,48)">(</span>QWidget <span style="color:rgb(128,128,48)">*</span>parent<span style="color:rgb(128,128,48)">)</span> <span style="color:rgb(128,0,128)">:</span> QWidget<span style="color:rgb(128,128,48)">(</span>parent<span style="color:rgb(128,128,48)">)</span>
<span style="color:rgb(128,0,128)">{</span>
QVTKWidget <span style="color:rgb(128,128,48)">*</span>qvtkwidget <span style="color:rgb(128,128,48)">=</span> <span style="color:rgb(128,0,0);font-weight:bold">new</span> QVTKWidget<span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(128,0,0);font-weight:bold">auto</span> axes <span style="color:rgb(128,128,48)">=</span> vtkSmartPointer<span style="color:rgb(128,0,128)"><</span>vtkAxesActor<span style="color:rgb(128,0,128)">></span><span style="color:rgb(128,0,128)">::</span>New<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
axes<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetXAxisLabelText<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,0,0)">"</span><span style="color:rgb(0,0,230)">x</span><span style="color:rgb(128,0,0)">"</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
axes<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetYAxisLabelText<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,0,0)">"</span><span style="color:rgb(0,0,230)">y</span><span style="color:rgb(128,0,0)">"</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
axes<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetZAxisLabelText<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,0,0)">"</span><span style="color:rgb(0,0,230)">z</span><span style="color:rgb(128,0,0)">"</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(128,0,0);font-weight:bold">auto</span> orientationMarker <span style="color:rgb(128,128,48)">=</span> vtkSmartPointer<span style="color:rgb(128,0,128)"><</span>vtkOrientationMarkerWidget<span style="color:rgb(128,0,128)">></span><span style="color:rgb(128,0,128)">::</span>New<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
orientationMarker<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetInteractor<span style="color:rgb(128,128,48)">(</span>qvtkwidget<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>GetInteractor<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
orientationMarker<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetOrientationMarker<span style="color:rgb(128,128,48)">(</span>axes<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
orientationMarker<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetEnabled<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(0,140,0)">1</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(105,105,105)">// sphere</span>
<span style="color:rgb(128,0,0);font-weight:bold">auto</span> sphereSource <span style="color:rgb(128,128,48)">=</span> vtkSmartPointer<span style="color:rgb(128,0,128)"><</span>vtkSphereSource<span style="color:rgb(128,0,128)">></span><span style="color:rgb(128,0,128)">::</span>New<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
sphereSource<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetCenter<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(0,140,0)">8</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,140,0)">8</span><span style="color:rgb(128,128,48)">,</span> <span style="color:rgb(0,140,0)">8</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
sphereSource<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetRadius<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(0,128,0)">5.0</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(128,0,0);font-weight:bold">auto</span> mapper <span style="color:rgb(128,128,48)">=</span> vtkSmartPointer<span style="color:rgb(128,0,128)"><</span>vtkPolyDataMapper<span style="color:rgb(128,0,128)">></span><span style="color:rgb(128,0,128)">::</span>New<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
mapper<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetInputConnection<span style="color:rgb(128,128,48)">(</span>sphereSource<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>GetOutputPort<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(128,0,0);font-weight:bold">auto</span> actor <span style="color:rgb(128,128,48)">=</span> vtkSmartPointer<span style="color:rgb(128,0,128)"><</span>vtkActor<span style="color:rgb(128,0,128)">></span><span style="color:rgb(128,0,128)">::</span>New<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
actor<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>SetMapper<span style="color:rgb(128,128,48)">(</span>mapper<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(128,0,0);font-weight:bold">auto</span> renderer <span style="color:rgb(128,128,48)">=</span> vtkSmartPointer<span style="color:rgb(128,0,128)"><</span>vtkRenderer<span style="color:rgb(128,0,128)">></span><span style="color:rgb(128,0,128)">::</span>New<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
renderer<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>AddActor<span style="color:rgb(128,128,48)">(</span>axes<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
renderer<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>AddActor<span style="color:rgb(128,128,48)">(</span>actor<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
vtkRenderWindow <span style="color:rgb(128,128,48)">*</span>renderWindow <span style="color:rgb(128,128,48)">=</span> qvtkwidget<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>GetRenderWindow<span style="color:rgb(128,128,48)">(</span><span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
renderWindow<span style="color:rgb(128,128,48)">-</span><span style="color:rgb(128,128,48)">></span>AddRenderer<span style="color:rgb(128,128,48)">(</span>renderer<span style="color:rgb(128,128,48)">)</span><span style="color:rgb(128,0,128)">;</span>
<span style="color:rgb(128,0,128)">}</span></pre></div><div>Why the orientation marker is not behaving as expected? Does the order of object creation in VTK matter (renderer, renderwindow, actors)? What should be the lifetime for each object in the code snippet above?</div><div><br></div><div>I appreciate any help,</div><div>JĂșlio.</div></div>