[vtkusers] How to connect vtk mouse interaction class with QT UI

Xiaopeng Yang yxp233 at postech.ac.kr
Fri Sep 23 11:29:34 EDT 2011


Dear All,

 

I guess some of you already met and solved this kind of problem. If you did
so, please share your great ideas with me. Thank you very much.

 

Best regards,

Xiaopeng

 

From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Xiaopeng Yang
Sent: Friday, September 23, 2011 9:16 PM
To: 'vtk'
Cc: insight-users at itk.org
Subject: [vtkusers] How to connect vtk mouse interaction class with QT UI

 

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

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110924/d51d0eeb/attachment.htm>


More information about the vtkusers mailing list