[Interest] simulating pinch
christop.probst at gmail.com
Wed Jan 10 23:01:00 CET 2018
Based on the example you provided I wrote this QML code and wanted to see
if this does indeed simulate a pinch.
//pinchArea is PinchArea QML type
var pinchSequence = touchEvent( pinchArea );
pinchSequence.press(0, pinchArea, 80, 80)
pinchSequence.press(1, pinchArea, 100, 100);
//outward pinch or zoom
pinchSequence.move(0, pinchArea, 70, 70);
pinchSequence.move(1, pinchArea, 110, 110);
On 10 January 2018 at 15:18, Christopher Probst <christop.probst at gmail.com>
> Thank-you Shawn, this is very helpful, I am going to try to use both
> testing approaches one in QML and one in C++. And I will post here what
> happens. But thanks again!
> On 10 January 2018 at 15:04, Shawn Rutledge <Shawn.Rutledge at qt.io> wrote:
>> On Jan 9, 2018, at 18:21, Christopher Probst <christop.probst at gmail.com>
>> I am trying to use the QML test framework to simulate a pinch. The API
>> which is here
>> does not provide any methods to simulate a pinch. This seems like an
>> There is code that shows how to do this here:
>> 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/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Interest