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

Decide what to do about long-press events and maybe right-click emulation in Qt 6

    XMLWordPrintable

    Details

      Description

      There is some old code in android/androidjniinput.cpp which should theoretically make a long press on a touchscreen turn into a right click if the env var QT_NECESSITAS_COMPATIBILITY_LONG_PRESS is set.

      We have had proposals to add this feature to other platforms: https://codereview.qt-project.org/c/qt/qtbase/+/270852 https://codereview.qt-project.org/c/qt/qtbase/+/288906

      One idea is to handle long press more or less the same as we handle double-clicks: send a special long press event, by having a timer in qtgui somewhere. The time interval could be configurable in QStyleHints alongside mouseDoubleClickInterval etc. But this idea is based on the assumption that we have to do this ourselves. Maybe some platforms can already do it, and maybe that's better or more efficient.

      If we're going to do it in platform plugins, we ought to at least have consistent API to turn the feature on or off. An application attribute or something.

      TapHandler currently does its own long-press detection. The downside is needing a timer in every TapHandler. The upside is that the time is configurable in every use case, whereas a shared timer in QtGui would have to be the same throughout an application. Then we have to think about whether to deprecate that longPressThreshold property: https://doc.qt.io/qt-5/qml-qtquick-taphandler.html#longPressThreshold-prop

      Adding a long-press event is one thing. But from those patch proposals it seems some users want legacy applications to "just work" on touchscreens, so they want it to turn into a right click. So maybe we need another application attribute for that, or something.

        Attachments

          Issue Links

          For Gerrit Dashboard: QTBUG-84179
          # Subject Branch Project Status CR V

            Activity

              People

              Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              Reporter:
              srutledg Shawn Rutledge
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews