[vtkusers] QVTKWidget not updating when interacting
gde23
gdeee at web.de
Mon Sep 11 06:55:04 EDT 2017
Hello,
i have a qvtkwidget that displays a vtkcontextview.
When i zoom (scrollwheel) or move the plot nothing seems to happen, however
when i click on another windwo and then back to the QMainwindow the plot is
in, it applies the zoom/interaction that was made before, so it seems there
is an update call missing.
void Plot::show()
{
// Set up a 2D scene, add an XY chart to it
vtkSmartPointer<vtkContextView> view =
vtkSmartPointer<vtkContextView>::New();
view->GetRenderer()->SetBackground(1.0, 1.0, 1.0);
view->GetRenderWindow()->SetSize(400, 400);
// set up chart
vtkSmartPointer<vtkChartXY> chart =
vtkSmartPointer<vtkChartXY>::New();
view->GetScene()->AddItem(chart);
chart->SetShowLegend(true);
int seq = m_spin_seqence->value();
int source = m_spin_source->value();
int surf = m_spin_surface->value();
vtkSmartPointer<vtkTable> table = m_core->getPoints();
// Add scatter plots
vtkPlot *points = chart->AddPlot(vtkChart::POINTS);
#if VTK_MAJOR_VERSION <= 5
points->SetInput(table, 0, 1);
#else
points->SetInputData(table, 0, 1);
#endif
points->SetColor(0, 0, 0, 255);
points->SetWidth(1.0);
vtkPlotPoints::SafeDownCast(points)->SetMarkerStyle(vtkPlotPoints::CROSS);
// For Qt integration
this->qvtkWidget->SetRenderWindow(view->GetRenderWindow());
view->SetInteractor(this->qvtkWidget->GetInteractor());
this->qvtkWidget->GetRenderWindow()->GetInteractor()->Initialize();
this->qvtkWidget->GetRenderWindow()->GetInteractor()->Start();
}
what am i missing?
--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
More information about the vtkusers
mailing list