|
QT development environment example
QtTouchPaintDemo
Demonstrates how to build a Qt
application that allows the user to paint in a window using both the mouse
and touches from a touch-pad or touch-screen, using Qt's touch events.
These events receive touch input from OS calls, such as WM_touch in Windows
and NSTouch in Mac OS X. In this application a simple widget is implemented
called "QPaintWidget", whose behavior is when the user clicks in
the window or generates a touch, a trail of color will follow, with a label
identifying which mouse button is pressed or the index of a touch. The
touches are received as QTouchEvents in the widget. A more up-to-date Linux
module using QT 5.x is available here.
QtTUIOPaintDemo
Demonstrates how to build a Qt
application that allows the user to paint in a window using both the mouse
and touches from a TUIO server. The
"QPaintWidget" is used again in this demo, except this time it has
outward facing functions for receiving touches from any source. This demo shows how to set up a TUIO
client using the demonstration TUIO client implementation available on the
TUIO website, and then pass the received touches to the QPaintWidget.
QtUPDDPaintDemo
Demonstrates how to build a Qt
application that allows the user to paint in a window using both the mouse
and touches received via the UPDD API.
The same implementation of "QPaintWidget" is used as
before in QtTUIOPaintDemo, except this time touches are received from a
callback registered with the UPDD and then passed on to the widget for
drawing.
Under Windows there are 32 bit
and 64 bit versions. The 32bit
version runs with UPDD 4.1.10 (any) and 5.0.x (32 bit). The 64 bit version
runs with UPDD 5.0.x (64bit).
A version with touch logging is
available here:.
Gesture calculation
The latest demo programs make use
of an in-house written gesture analyzer to calculate the gesture being
performed on the touchscreen and list this in the demo screen. To prevent
the analysis function being used outside our demo programs it only
functions for 5 minutes at which point is stops working. Both
QtUPDDPaintDemo and QtTUIOPaintDemo use the TBGestureAnalyzer static
library.
QtTouchPaintDemo uses Qt's own
gesture recognition for gestures. However, it seems that this doesn't work
consistently between platforms. In
Windows 7 (not XP as Qt uses the Windows 7 multitouch API), it will only
detect "pinch", "pan", and "tap" gestures in
our touch screen tests. In OS X, it
can detect all gestures that Qt supports, but different ones will be
detected depending on if used with an Apple magic trackpad or a touch
screen with UPDDGestures running. Reading online, other
developers are seeing the same behavior, so we consider this an issue with
Qt. We haven't been able to get it
to work at all in Linux so far when testing under Ubuntu 11.10).
Examples
In this example, run under
Windows XP, the UPDD-TUIO-Bridge software is running
to offer a TUIO server. Both the UPDD and TUIO applications have been
invoked and placed side-by-side. A dual touch screen has been touched. TUIO
app is drawing via TUIO events and UPDD is drawing via the UPDD API
Callback function.

In this example, with built in
gesture analysis, the rotate anti clockwise movement of the dual touch is
calculated and listed:

Notes
Executables are available for
Mac, Linux and Windows
Windows and Mac apps statically
linked with required libraries, Linux dynamically linked. UPDDPaintDemo
should be run in UPDD folder so as to access correct versions of tbapi.dll
and ACE_UPDD_n.n.n.DLL.
Windows may require you to
install the Microsoft Visual C++ Redistributable Package. Applications
will report that a required .DLL is missing if the run-time is not
installed.
|