Important: Please read the Qt Code of Conduct -

How to start with a touchscreen device programming in QT

  • how to check weather their are available touchscreen drivers for the device support for Qt.

    enum QTouchEvent::DeviceType :- is this value need to be set by programer or directly set from kernel

    Qt::TouchPointStates :- how are these states taking input?

    how can we handle QEvent for touch?

  • At the moment the best way of creating GUIs is using the QtQuick system.
    There are a lot of reason for using QtQuick, but concerning your question, with QtQuick the handling of touchscreen is very straitghforward and easy !!

    Take a look of this starting guide:

  • Moderators

    Gianluca this is not what OP is asking about. Both QtWidgets and QtQuick work with touch screens, but tarunb is more or less asking how to detect the presence of a touch device.

  • Yes, ok ... but I suppose that the final purpose of detecting a touch device is to enable the using of touches gestures and/or multitouch event, etc.

    But with QtQuick all this checking are superflous because:

    • in the scenario where your app does not need a multi-touch handling and/or touch gesture, you can simply use "MouseArea" that works automatically for mouse clicks and for touches (depend on the capabilities of the device) - So, you don't need to check if the device can accept touches or not, QtQuick does it for you
    • in the scenario where your app need multi-touch handling and/or touch gesture, then you add a "MultiPointTouchArea" to use in combination with "MouseArea" and in this case, the "MultiPointTouchArea" will works when touches are possible and allow to handle gestures and multi-touches event when the device allow that - Again, you don't need to explicity check if the device can accept multi-touches or not, QtQuick does it for you

    That's my long answer. Maybe now is more clear my point :-)

  • Hello -

    I have a question. If we are using QtQuick 2.0 + Qt 5 on Wayland in a tablet, should we expect the application to "just work"? Is it possible that the Qt 5 on Wayland may not hook up to the touch screen correctly?

    Thank You,


Log in to reply