Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QWheelEvent on Android
Qt 6.11 is out! See what's new in the release blog

QWheelEvent on Android

Scheduled Pinned Locked Moved Mobile and Embedded
5 Posts 3 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SebiSebi
    wrote on last edited by
    #1

    I've made an small application on PC and now i'm trying to deploy it on AVD.
    The application uses QWheelEvent which does not work in my case (on Andorid only).
    How is this event handled on Android and how can i solve this problem?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      Xander84
      wrote on last edited by
      #2

      Android devices have no (mouse) wheel, so it will never be called I guess. :D
      you have to use your own pinch event or something, in my app I implemented the pinch event myself, Qt has no touch gesture events at the moment I think.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SebiSebi
        wrote on last edited by
        #3

        It is obvious that Android devices have no wheel. But how can I use zoom, for example, on Android devices?

        1 Reply Last reply
        0
        • X Offline
          X Offline
          Xander84
          wrote on last edited by
          #4

          Did you even read my post? I told you there is no easy way as far as i know :/
          you have to implement your own pinch-to-zoom event or whatever you want to zoom it depends on the app, you can also use buttons (+ and -) :D

          I mean there are Qt classes like QGesture, QGestureEvent and QPinchGesture but I think there is no way as of Qt 5.2.1 or even 5.3 to use it properly? "The API of the gesture framework is not yet finalized and still subject to change."

          Best thing i could find http://qt-project.org/doc/qt-5/gestures-overview.html

          1 Reply Last reply
          0
          • K Offline
            K Offline
            Kalileo
            wrote on last edited by
            #5

            There are quite a few Android PCs available now, using mouse and keyboard, and a mouse or a wireless mouse is used quite often together with an Android Set Top Box connected to a TV.
            The mouse wheel is supported in many Android applications, e.g. the browser.
            So the wheel exists in Android, and is supported by Android. Android Apps can react on mouse wheel events, see also http://stackoverflow.com/questions/11024809/how-can-my-view-respond-to-a-mousewheel

            Example Java code from the link above, I guess this could be added to QtActivity:

            @@Override
            public boolean onGenericMotionEvent(MotionEvent event) {
            if (0 != (event.getSource() & InputDevice.SOURCE_CLASS_POINTER)) {
            switch (event.getAction()) {
            case MotionEvent.ACTION_SCROLL:
            if (event.getAxisValue(MotionEvent.AXIS_VSCROLL) < 0.0f)
            selectNext()
            else
            selectPrev();
            return true;
            }
            }
            return super.onGenericMotionEvent(event);
            }@

            And IMHO we need the mouse wheel supported in Qt for Android too, of course.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved