Search code examples
c++qtqmlmulti-touchtouchscreen

Detecting touch properties of the screen


Is there a way in QML or Qt or C++ to know if the screen (or the platform) support tactile, and more specifically, if the screen support multitouch

Is this even possible ?

EDIT :

On windows it seems we could try to enumerate the device to find one that match https://support.microsoft.com/en-us/kb/259695

This should also be possible on linux

RELATED :

What's the best way to detect a 'touch screen' device using JavaScript?

Is there a way to determine if the current screen supports touch?


Solution

  • You can use the static QTouchDevice::devices() function to enumerate the available touch devices, and the capabilities() function to check the capabilities of individual devices. To check for multitouch support, you would probably call maximumTouchPoints().

    The QTouchDevice class describes the device from which touch events originate.

    Each QTouchEvent contains a QTouchDevice pointer to allow accessing device-specific properties like type and capabilities. It is the responsibility of the platform or generic plug-ins to register the available touch devices via QWindowSystemInterface before generating any touch events. Applications do not need to instantiate this class, they should just access the global instances pointed to by QTouchEvent::device().