Emulating Touch

Touch screens allow users to interact with devices by touching the screen with one or more fingers. When designing applications for touch screen, try to minimise user input. Using a touch screen increases the risk of errors during data input, when compared with using a keypad.

Touch screens consume most power during touch operations. Avoid unnecessary user interaction also to increase power efficiency. Specifically, with resistive touch screens, avoid excessively long touch and drag actions. The continuous touch event flow keeps the CPU busy. The screen lock turns off the touch completely.

To prevent user errors, design user interaction so that navigation and controls are clear and meaningful. Meaningful controls are easy to learn and remember. For example, strokes along the touch screen should produce a logical outcome.

You can use the emulator to test the following types of gestures:

  • Tap
  • Pinch
  • Pan
  • Swipe

Testing Touch Events

"Touch view"

In the Multipoint-touch view, select the type of touch event to emulate:

  • Default mode (Alt+1) emulates tapping the screen with a finger.
  • Pinch mode (Alt+2) emulates a two-finger stroke that is typically used to change the scale factor, zoom, or level of detail of the user interface. To pinch open, users place two fingers close together on the screen and move them apart without lifting them from the screen. Similarly, to pinch close, users move the fingers toward each other.
  • Pan mode (Alt+3) emulates using two fingers to drag content on the screen, instead of using a scroll bar for movement.
  • Swipe mode (Alt+4) emulates sliding 3 fingers quickly left or right on the screen. Swipe may be used, for example, when viewing images: an image is swiped left or right to view the next or previous image, respectively.
  • Free mode (Alt+5) allows you to select scripts that emulate touch events.

Pinch Mode

To emulate a pinch gesture, click on the screen to set the reference point (1), and then click and drag the mouse to move the touch points (2) that represent the user's fingers.

"Pinch mode

Pan Mode

To emulate a pan event, click on the screen, and then click again and drag the mouse to move the content on the screen.

"Pan mode"

Swipe Mode

To emulate a swipe gesture, click on the screen twice to set two touch points, and then click again and drag the mouse left or right to move to the previous or next item, for example.

"Swipe mode"

Note: Swipe gestures require 3 touch points to be recognized, and therefore, they only work on devices that have 3 touch points.

Free Mode

To run scripts that emulate touch events, click Browse to locate the script on the development PC. Click on the screen to run the script.

In the scripts, you can either use screen cordinates to indicate touch points, or specify them as relative to the position of the mouse on the screen. For example, see the touch script examples in scripts/examples/.

© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.