# Touchscreen Pan Gesture on a Qt-QML application

**URL:** https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535
**Category:** Support
**Created:** [February 4, 2020, 2:51am UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535 "2020-02-04T02:51:49Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Synfony](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@Synfony](https://discourse.vtk.org/u/Synfony)
#### Post date: [February 4, 2020, 2:51am UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/1 "2020-02-04T02:51:49Z")

</div>

Hi,  
First of all, I tried to build the TouchGestureViewer example (from [https://gitlab.kitware.com/vtk/vtk/tree/master/Examples/GUI/Qt/TouchGestureViewer](https://gitlab.kitware.com/vtk/vtk/tree/master/Examples/GUI/Qt/TouchGestureViewer)) using VTK8.2.0 and Qt5.12.6 on Windows10(64 bit) surface.

But I see these error messages:

```
'EndGesture': is not a member of 'vtkInteractorStyleMultiTouchCameraExample'	QtVTKTouchscreenRenderWindows.cxx (257)
'StartGesture': is not a member of 'vtkInteractorStyleMultiTouchCameraExample'	QtVTKTouchscreenRenderWindows	
QtVTKTouchscreenRenderWindows.cxx (245)	

```

Is there anything that I am missing? But, all other examples work fine on my machine.

Secondly, I have a QML application that renders VTK enabled 3D graphics. How should I be able integrate touch gestures on VTK window that is inside a QML item?

Thanks!

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [February 4, 2020, 3:10am UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/2 "2020-02-04T03:10:54Z")

</div>

> [@Synfony](#):
>
> First of all, I tried to build the TouchGestureViewer example (from [https://gitlab.kitware.com/vtk/vtk/tree/master/Examples/GUI/Qt/TouchGestureViewer](https://gitlab.kitware.com/vtk/vtk/tree/master/Examples/GUI/Qt/TouchGestureViewer)) using VTK8.2.0 and Qt5.12.6 on Windows10(64 bit) surface.

Do you mean that you took TouchGestureViewer example from one VTK version and tried to use it in a different VTK version? You probably need to backport all related changes into your VTK version.

> [@Synfony](#):
>
> I have a QML application that renders VTK enabled 3D graphics. How should I be able integrate touch gestures on VTK window that is inside a QML item?

We use VTK in a [ctkVTKAbstractView](https://github.com/commontk/CTK/blob/master/Libs/Visualization/VTK/Widgets/ctkVTKAbstractView.h) and we know it works well there. I would recommend to check first that it works for you in classic Qt application/widget and then try if it works in QML as well.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 5, 2020, 1:33pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/3 "2020-02-05T13:33:04Z")

</div>

Welcome, friend,

`vtkInteractorStyleMultiTouchCameraExample` doesn’t implement, override nor inherit any methods called `EndGesture()` or `StartGesture()` hence the error. Why such error is in that example left me scratching my head…

Anyway, I suggest replacing `StartGesture()` with [`OnStartRotate()`](https://vtk.org/doc/nightly/html/classvtkInteractorStyleMultiTouchCamera.html#a5702b6a0fd74c0f5d8bbf07da0f75317). Likewise, `EndGesture()` with [`OnEndRotate()`](https://vtk.org/doc/nightly/html/classvtkInteractorStyleMultiTouchCamera.html#a290ab8ddbd18216220350fbc4ea14a8a), if the swipe gesture is meant to rotate the model. The forementioned methods are both defined in [`vtkInteractorStyleMultiTouchCamera`](https://vtk.org/doc/nightly/html/classvtkInteractorStyleMultiTouchCamera.html). See whether those work.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [February 5, 2020, 3:47pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/4 "2020-02-05T15:47:31Z")

</div>

Which VTK version are you using? Maybe the example was not updated according to recent changes in VTK API.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 5, 2020, 4:59pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/5 "2020-02-05T16:59:36Z")

</div>

The documentation I cited is supposed to be that of the latest (nightly build). The offending methods are not there. Maybe someone should contact the author of the example to report this.

---

<div class="post-metadata">

### Author: ![Synfony](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@Synfony](https://discourse.vtk.org/u/Synfony)
#### Post date: [February 5, 2020, 6:41pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/6 "2020-02-05T18:41:32Z")

</div>

Hi Paulo,  
Thank you very much for your replies. I am using VTK8.2.0 latest release.  
I tried to use use OnStartRotate() and OnEndRotate() methods (instead of StartGesture() and EndGesture() methods) as you mentioned. But, only methods available are OnStartSwipe() and OnStartSwipe() - even if I attempt to use these two methods I get these errors:

```
'vtkInteractorStyleMultiTouchCameraExample::OnStartSwipe': method with override specifier 'override' did not override any base class methods

```

‘vtkInteractorStyleMultiTouchCameraExample::OnEndSwipe’: method with override specifier ‘override’ did not override any base class methods

---

<div class="post-metadata">

### Author: ![Synfony](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@Synfony](https://discourse.vtk.org/u/Synfony)
#### Post date: [February 5, 2020, 6:45pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/7 "2020-02-05T18:45:38Z")

</div>

Hi Andras,  
I am using VTK8.2.0 latest release.  
The only example I can find on Touch gesture is [https://gitlab.kitware.com/vtk/vtk/merge\_requests/5679](https://gitlab.kitware.com/vtk/vtk/merge_requests/5679)

But, it looks like it is outdated.  
Is there any other example available? How could we inform the author of this example for possible updates?

Thanks a lot.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 5, 2020, 7:14pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/8 "2020-02-05T19:14:25Z")

</div>

Strange… Both methods are implemented in `vtkInteractorStyleMultiTouchCameraExample`'s superclass: [https://vtk.org/doc/nightly/html/classvtkInteractorStyleMultiTouchCamera.html](https://vtk.org/doc/nightly/html/classvtkInteractorStyleMultiTouchCamera.html) . `vtkInteractorStyleMultiTouchCameraExample` should’ve inherited them. Do you have older versions of VTK in your system?

---

<div class="post-metadata">

### Author: ![Synfony](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@Synfony](https://discourse.vtk.org/u/Synfony)
#### Post date: [February 5, 2020, 8:10pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/9 "2020-02-05T20:10:31Z")

</div>

I have one and only version of VTK (8.2.0) installed. I have checked and confirmed that no other older version exits in my machine.

I am trying to build Sunderlandkyl ([https://gitlab.kitware.com/Sunderlandkyl](https://gitlab.kitware.com/Sunderlandkyl)) example.

It looks like something is missing!  
Your help is much appreciated!

---

<div class="post-metadata">

### Author: ![Sunderlandkyl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sunderlandkyl/32/230_2.png) [@Sunderlandkyl](https://discourse.vtk.org/u/Sunderlandkyl)
#### Post date: [February 5, 2020, 9:16pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/10 "2020-02-05T21:16:24Z")

</div>

The Qt touchscreen support was added after VTK 8.2.0. It should work if you try with the latest VTK.

---

<div class="post-metadata">

### Author: ![Synfony](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@Synfony](https://discourse.vtk.org/u/Synfony)
#### Post date: [February 5, 2020, 9:30pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/11 "2020-02-05T21:30:26Z")

</div>

Hi Kyle,  
Thanks for your reply.  
I believe I have got the latest version of VTK (which is 8.2.0) downloaded recently from [https://vtk.org/download/](https://vtk.org/download/)

Could you please help me find the latest version of the touchscreen example you provided?  
I am using this one: [https://gitlab.kitware.com/vtk/vtk/tree/6488ef5d38d2eae1ff79d78a0922a7f5b6af828f/Examples/GUI/Qt/TouchGestureViewer](https://gitlab.kitware.com/vtk/vtk/tree/6488ef5d38d2eae1ff79d78a0922a7f5b6af828f/Examples/GUI/Qt/TouchGestureViewer)

Please let me know if this is correct.

Thank you once again.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [February 5, 2020, 9:38pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/12 "2020-02-05T21:38:30Z")

</div>

After 8.2.0? According to [https://vtk.org/download/](https://vtk.org/download/), 8.2.0 is the latest. So, what is later than the latest?

---

<div class="post-metadata">

### Author: ![Sunderlandkyl](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sunderlandkyl/32/230_2.png) [@Sunderlandkyl](https://discourse.vtk.org/u/Sunderlandkyl)
#### Post date: [February 5, 2020, 9:46pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/13 "2020-02-05T21:46:31Z")

</div>

There have been no releases since 8.2.0, so if you would like to compile the example you will need to compile VTK from the master branch (which is 8.90.0).

---

<div class="post-metadata">

### Author: ![Synfony](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/b5a626/32.png) [@Synfony](https://discourse.vtk.org/u/Synfony)
#### Post date: [February 5, 2020, 10:32pm UTC](https://discourse.vtk.org/t/touchscreen-pan-gesture-on-a-qt-qml-application/2535/14 "2020-02-05T22:32:17Z")

</div>

I will try with the master branch (8.90.0) to compile Kyle’s touchscreen example and will report my findings here.

Once again, thank you Paulo and Kyle for your responses.
