1

I currently have a Qt MainWindow, which holds a number of controls including a QVTKWidget. I can easily add a vtkChartXY object using a vtkContextView to the QVTKWidget:

vtkSmartPointer<vtkContextView> m_2Dview = vtkSmartPointer<vtkContextView>::New();
m_2Dview->SetRenderWindow(this->QVTKWidget->GetRenderWindow());

However, once I have it in the QVTKWidget, I can not find a way to return to the 3d view. I tried using the vtkContextActor, but it led to interaction issues. However, I'm willing to try out any suggestions if the vtkContextActor is the way to go.

Drise
  • 4,310
  • 5
  • 41
  • 66

1 Answers1

2

What I did to resolve this was to reset the vtkrenderer on the vtkrenderwindow by removing the vtkrenderer from the pointer of the vtkRenderWindow after storing the vtkRenderer pointer first, and then added the renderer I had stored back into the vtkRenderWindow.

This reset the view for me at least and below is the snippet I used.

AnalysisWindow is my pointer to the actual vtkRenderer.

if(AnalysisWindow != NULL)
{
    vtkSmartPointer<vtkRenderWindow> win;
    win = AnalysisWindow->GetRenderWindow();
    win->RemoveRenderer(AnalysisWindow);
    win->AddRenderer(AnalysisWindow);
}
Mihai Iorga
  • 39,330
  • 16
  • 106
  • 107