[vtkusers] How to connect vtk mouse interaction class with QT UI
Alex Malyushytskyy
alexmalvtk at gmail.com
Fri Sep 23 18:39:06 EDT 2011
As far as I understand before getting renderer you have to add ( at least one ).
you may check with
this->ui->qvtkWidget->GetRenderWindow()->GetRenders(); and check
number of them in collection if you want,
If you need just one renderer you might create one and add
(AddRenderer ) one in constructor.
Your code in green is pure black box for me.
I failed to understand what you were trying to get there.
As far as I can see ClientData is not a member of this class and not
defined anywhere so result of compilation is predictable.
Alex
On Fri, Sep 23, 2011 at 5:16 AM, Xiaopeng Yang <yxp233 at postech.ac.kr> wrote:
> Dear Users,
>
>
>
> I would like to render my qvtkWidget when I right click the mouse. But the
> following code has error in the red line. Could you point out where I made a
> mistake?
>
>
>
> And also I would like to execute addpoint() when I right click the mouse. So
> I tried the code in green line. But it also had error. Do you how to execute
> addpoint by the mouse interaction?
>
>
>
>
>
> SimpleView::SimpleView()
>
> {
>
> this->ui = new Ui_SimpleView;
>
> this->ui->setupUi(this);
>
> }
>
>
>
>
>
> SimpleView:: addpoint()
>
> {
>
> }
>
>
>
> class MouseInteractorStylePP : public vtkInteractorStyleTrackballCamera
>
> {
>
> public:
>
> static MouseInteractorStylePP* New();
>
> vtkTypeMacro(MouseInteractorStylePP, vtkInteractorStyleTrackballCamera);
>
> virtual void OnRightButtonDown()
>
> {
>
>
> this->Interactor->GetPicker()->Pick(this->Interactor->GetEventPosition()[0],
>
> this->Interactor->GetEventPosition()[1],
>
> 0,
>
> this->Interactor->GetRenderWindow()->GetRenderers()->GetFirstRenderer());
>
> double picked[3];
>
> this->Interactor->GetPicker()->GetPickPosition(picked);
>
> std::cout << "Picked value: " << picked[0] << " " << picked[1] << "
> " << picked[2] << std::endl;
>
>
>
> this->ui->qvtkWidget->GetRenderWindow()->Render(); ?? Error here
>
>
>
> SimpleView *workspace = (SimpleView*)ClientData; //ClientData:
> undefined
>
> workspace->addPoint();
>
> }
>
>
>
> Thanks a lot!
>
>
>
> Best regards,
>
> Xiaopeng
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list