[vtkusers] PolyData Opacity with QSlider

Andaharoo Andx_roo at live.com
Fri Jan 19 00:47:31 EST 2018


Not entirely sure what you need but in my program I connect to the
valueChanged(int) signal emitted by a QSlider. So for example:

connect(slider, SIGNAL(valueChanged(int)), this, SLOT(sliderChanged(int)));

Which would connect to my sliderChanged(int) function. Then you can just do
something like:

void sliderChanged(int newValue) {
    actor->GetProperty()->SetOpacity(static_cast<double>(newValue) / 100.0);
}

Then as long as your pipeline is setup like vtkPolyData -> vtkPolyDataMapper
-> vtkActor and that actor is added to the renderer you should be fine. You
might need to call update on your qvtkwidget.



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list