Using a LeapMotion for Qt inputs

We are still working on our project Tepee3D and although we have not yet reached the popularity we hoped too, this project has allowed us to work on many interesting aspects, one of which is adding LeapMotion inputs to our application.
For those of you who don’t know what a LeapMotion is, it is a small sensor about the size of a lighter that you can use to track hands movement in space.
You can find more information about it on the LeapMotion web site.

Leap Motion

Leap Motion (Photo credit: khawkins04)

There are several ways to interact with an application using the LeapMotion sensor. However as Tepee3D has mainly been focused on touch and multitouch inputs, one simple way to use the LeapMotion was to convert fingers 3D position in Qt touch points so that they could then be used in QTouchEvent or QMouseEvents without having to rewrite the entire application.

For the specific gestures (swipe, circle, screentap, keytap) offered by the Leap SDK, creating a custom QtQuick/QWidget element that will handle these is a clean way to include the additional inputs of the LeapMotion without compromising touch and mouse inputs on platforms that do not have access to a LeapMotion.

Though originally developed for Tepee3D, this library is made to work with any Qt/QtQuick application.

Those not interested by the code explanation below, you can directly obtain the sources and a sample project here.
Continue reading