interacción qvtkwidget con un control deslizante
Frecuentes
Visto 1,110 veces
0
I have a problem with qvtkwidget. I have a cube with the vtkimageplanewidget and i already made the connection between the sliders and them, but I want the slider to change also when I change the planes with the mouse in the qvtkwidget.
¿Cómo puedo hacer eso?
Here's how I connected the slider eith the planes.
RANURA:
void planevolume::SplaneXpixel()
{
double xvalue=ui->Slider->value();
planeX->SetSliceIndex(xvalue);
ui->qvtkWidget->update();
}
y entonces:
connect(ui->Slider, SIGNAL(valueChanged(double)), this, SLOT(SplaneXpixel()));
What about the opposite? I tried:
RANURA:
void planevolume::planeXSpixel()
{
double xvalue=planeX->GetSliceIndex();
ui->Slider->setValue(xvalue);
ui->qvtkWidget->update();
}
y entonces:
connect(ui->qvtkWidget, SIGNAL(mouseEvent(QMouseEvent*)), SLOT(planeXSpixel()));
but it won't work, can anyone help me?
2 Respuestas
1
I believe you are looking for vtkEventQtSlotConnect. Here is an example: http://www.vtk.org/Wiki/VTK/Examples/Cxx/Qt/EventQtSlotConnect
respondido 14 nov., 12:00
0
If you work with the UI form, right click the slider, choose "Go to slot..." and select the sliderMoved(int) slot. Inside the automated slot created by Qt, it should be on_slider_sliderMoved(int position). just insert your code there. maybe this implementation should help you further:
respondido 11 mar '13, 05:03
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas qt connection slider vtk or haz tu propia pregunta.
What won't work? I'd suggest posting a fully compilable example, and explaining what is going wrong. - David Doria