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

Xiaopeng Yang yxp233 at postech.ac.kr
Fri Sep 23 20:17:11 EDT 2011


Alex and David,

Thank you for your reply. Sorry to make you confused about my question. The
first error is that "'ui' : is not a member of 'MouseInteractorStylePP'".
That's why I am asking how to connect the mouse interaction class with QT
ui.

The second problem is that if I would like to call addPoint() within the
mouse interaction class, how to fulfill this? 

Thank you very much.

Best,
Xiaopeng

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Alex Malyushytskyy
Sent: Saturday, September 24, 2011 7:39 AM
To: vtk
Subject: Re: [vtkusers] How to connect vtk mouse interaction class with QT
UI

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
>
>
_______________________________________________
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