[Interest] simulating pinch

Shawn Rutledge Shawn.Rutledge at qt.io
Wed Jan 10 21:04:31 CET 2018


On Jan 9, 2018, at 18:21, Christopher Probst <christop.probst at gmail.com<mailto:christop.probst at gmail.com>> wrote:

Hello,

I am trying to use the QML test framework to simulate a pinch. The API which is here

http://doc.qt.io/qt-5/qml-qttest-testcase.html

does not provide any methods to simulate a pinch. This seems like an oversight.

There is code that shows how to do this here:

http://code.qt.io/cgit/qt/qtdeclarative.git/tree/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp

A pinch is a touch event with two touch points.  You can see how QTest::touchEvent is started on line 222 for example, on line 234 it moves both touch points simultaneously, etc.  So that’s an example of how to write a pinch test in C++ (which I recommend, if you can: mainly because the C++ debugger is nicer to use than the QML one, IMO, and tests always seem to end up needing debugging at some point).

If you want to write the test in QML, see http://doc.qt.io/qt-5/qml-qttest-testcase.html#touchEvent-method and http://code.qt.io/cgit/qt/qtdeclarative.git/tree/tests/auto/qmltest/events/tst_touch.qml#n146

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180110/368ff980/attachment.html>


More information about the Interest mailing list