Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116442

Doubleclick sent to first item when single-clicking alternating items

    XMLWordPrintable

Details

    • All

    Description

      MouseArea can emit doubleClicked() if it was clicked after another item was clicked.

      QQuickDeliveryAgentPrivate::checkIfDoubleTapped(), which is called on every tap-to-mousepress, checks the new press position and the new press timestamp, to determine whether a press is a doubletap. It doesn't explicitly check if it's the same item that was pressed before, so, to prevent the current logic from wrongfully detecting doubletap, either the timestamp or the position checks must fail.

      The timestamp check will pass if the system double click interval is large, and/or the click is quick (e.g. rapid tapping, or programmatically in an automated testcase). The last timestamp (touchMousePressTimestamp) can be reset, it happens sometimes, unfortunately it can be reset to 0 which is a valid timestamp. In a test case, if 0 is used as the timestamp, a-b will always be 0.

      The distance test will pass if the new press is close to or identical with the old press. For this test to fail, the old press position (touchMousePressPos) could get reset when the new item is pressed. This logic is hard to follow and seems a bit unstable, but this sometimes happens. It's flaky though, since the touchMousePressPos can be reset to a new position whose distance is also within the threshold.

      See attached isolated example. This error happens in our automated tests, apologies for any errors in the example itself but it's hard to fake events correctly in order to trigger the error.

      Testcase explained: Two items next to eachother are clicked - left then right then left. If the right item is a RoundButton, the second click on the mouse area will be a doubleclick. If the right item is a MouseArea, it will not. The reason in this particular case is that touchMousePressPos is changed when the MouseArea is pressed, but not when the RoundButton is pressed.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              andrhans Andreas Aardal Hanssen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes