Vedo: How to make the interaction with VTK in qt more user friendly

Created on 16 Dec 2019  路  7Comments  路  Source: marcomusy/vedo

Hello,

I am following your example on embedding vtkplotter to Qt windows. The problem is that the interaction with the object using the mouse (in the example is a Cone) is not intuitive, here is what I mean by that:

  • When I click on the object to rotate it, it keeps rotating by itself.
  • In vtkplotter (without Qt window) it is more intuitive.

Sorry if this is not clear. Is there an option to change that behavior in Qt to make the interaction similar to vtkplotter.

Thank you

All 7 comments

Unfortunately when embedding in qt the key shortcuts are not active, still you can press t to switch interaction mode.

I have tried that but I don't see any difference. Let me give more details (even though I am sure that is very hard for me to describe it).

  • In Qt vtk when you just press the left mouse button on the object (without moving the mouse), the object starts rotating by itself until the left button of the mouse is released this is very annoying since I couldn't Pan the object or rotate it as expected (This is the behaviour that I am trying to describe above).

In the other hand, in vtkplotter itself when I run something vtkplotter filename.vtk the interaction using the mouse with the object is very user friendly.

Is it possible to change the behaviour in the vtk embeded in Qt?

Thank you

Yes - sorry, you are right .. in qt keys are completely disabled..
You can recover it with:

import vtk

# ...
        vp += Cone()

        vp.interactor.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
        vp.show()      # create renderer and add the actors

Exactly what I was looking for!!
Thank you very much
:1st_place_medal:

Hello, I suggest to add the line:

vp.interactor.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())

in the examples. I struggled some times with the same strange behavior.

Thanks very much!

Yep!
you can also achieve the same with:
show(..., interactorStyle=0)

...OPS... it looks like there's a bug ... i'll fix that in the next release!

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DeepaMahm picture DeepaMahm  路  5Comments

m-albert picture m-albert  路  7Comments

FedeClaudi picture FedeClaudi  路  6Comments

hmralavi picture hmralavi  路  7Comments

Yoorthiziri picture Yoorthiziri  路  5Comments