Fork me on GitHub

Interact with your Qt-based desktop applications following the same idioms brought to you by phones and tablets.


Qt Gui

The Gui module of Qt specializes core events to provide interaction ones, such as mouse clicks or key presses. Such events may be gestures events, such as pan, swipe or pinch events. Many applications already implement gesture event handling. The Gui layer of QLeap generates such events so that existing applications handling Qt Gestures can be controlled by the Leap Motion device without additional work.

Gesture events may be posted by the Leap Motion device wrapper.
bool Object::event(QEvent *event)
{
    if (event->type() == QEvent::Gesture)
        return gestureEvent(static_cast<QGestureEvent*>(event));
      
    return QObject::event(event);
}         

However, the Leap Motion controller is up to 200 times more accurate than any other gesture control system, and also, is not restricted to a plane, gestures occur in a 3D space. This means that using the Leap Motion device, one can control an application with many more gestures than the usual pan, pinch, swipe, tap and hold. Qt gui provides, together with its gesture framework, a simple way to generate custom gesture events by implementing gesture recognizers. The Gui layer of QLeap provides new gestures.

Handling of both standard and custom gestures.
bool Object::gestureEvent(QGestureEvent *event)
{
    if (QGesture *gesture = event->gesture(Qt::SwipeGesture))
	return panGesture(static_cast<QPanGesture *>(gesture));
    
    if (QGesture *gesture = event->gesture(QLeap::CircleGesture))
        return circleGesture(static_cast<QLeapCircleGesture *>(gesture));

    return true;
}         

Qt Quick

The Quick module of Qt provides all the basic elements necessary for creating user interfaces with QML. It provides a visual canvas and includes types for creating and animating visual components, receiving user input, and more. Qt Quick deals with user input by providing areas that can be directly declared in QML documents, but also by providing handling Qt Core events. Areas include mouse and multi point touch areas, events include keyboard input and device motion. The QLeap wrappers generated events can be handled within a QML document.

Handling of standard user input generated by QLeap wrapper.
import QtQuick 2.0


Rectangle {
    MouseArea {
        anchors.fill: parent;
        onClicked: {
            foo();
        }
    }
}
Handling of custom user input generated by QLeap wrapper.
import    QtQuick 2.0
import QLeapQuick 1.0

Rectangle {
    LeapArea {
        anchors.fill: parent;
        onCircle: {
            bar();
        }
    }
}

Qt Widgets

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent suscipit convallis dui ut volutpat. Aenean sagittis lacinia odio non iaculis.


#

QLeap is at early development stage. Features will be made available as the development goes on. You can however feel free to follow and contribute anyway you like, by testing, coding or sharing ideas.