Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Qt 4.8] Capturing mouse wheel

[Qt 4.8] Capturing mouse wheel

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.1k 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.
  • M Offline
    M Offline
    mnbv
    wrote on last edited by
    #1

    I have a custom Qt widget that displays some 3D content. The user can rotate the display with the left button and zoom with the wheel.

    I am responding to left drag with mousePress, mouseMove, and mouseRelease event handlers. I am responding to the wheel with a wheel event handler.

    While dragging the left button works fine, and the widget captures the mouse and continues to receive events from outside of its area as long as the button is held down, I would like to also capture mouse wheel events as long as the left button is down.

    The reason I want to do this is because sometimes the user is rotating and zooming at the same time. The behavior here is that they will press the left button, drag, use the wheel while dragging the left button, then release the left button. The problem is that the wheel events are not "captured", and so if the user is rotating the display and moves the mouse outside of the widget's client area, but is using the wheel at the same time, the wheel events are sent to whatever other widget happens to be under the pointer at that time, causing selections and such that the user does not expect.

    So basically, as long as the user is dragging with the left button, I'd also like wheel events to be directed only to the widget regardless of where the mouse is on the screen.

    Is there a way to have a widget grab wheel events from outside its client area while a left drag is in progress?

    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