Details
-
Task
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
-
None
Description
- Wheel scroll lines
- QPlatformTheme::ThemeHint::WheelScrollLines
- "The number of lines to scroll a widget, when the mouse wheel is rotated. The default value is 3. \sa QApplication::wheelScrollLines()"
- Integer, can't do fractional lines
- "when the mouse wheel is rotated"
- By how much?
- One "click"?
- 120 degrees?
- A full 360 rotation?
- Likely based on Windows. Default 3. SPI_GETWHEELSCROLLLINES
- Windows UI says "choose how many lines to scroll each time", so likely option #1
- By how much?
- Exposed as QStyleHints::wheelScrollLines and QApplication::wheelScrollLines and overridable via QStyleHints
- "the number of lines to scroll a widget, when the mouse wheel is rotated."
- macOS
- No system setting
- NSScrollView.horizontalLineScroll
- Number of pixels to scroll when scrolling line by line
- Default 10
- Doesn't say anything about how much to scroll per tick/degree of the wheel
- Number of pixels to scroll when scrolling line by line
- QPlatformTheme::ThemeHint::WheelScrollLines
- Wheel delta
- Windows
- https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
- The wheel rotation will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.
The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels (a freely-rotating wheel with no notches) to send more messages per rotation, but with a smaller value in each message. To use this feature, you can either add the incoming delta values until WHEEL_DELTA is reached (so for a delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You can also choose your scroll granularity and accumulate deltas until it is reached.
- The wheel rotation will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.
- Can opt in to higher resolution deltas
- https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
- macOS
- NSEvent.scrollingDeltaY
- "When hasPreciseScrollingDeltas is NO, multiply the value returned by this method by the line or row height. Otherwise scroll by the returned amount."
- So for non-touchpads if the value is 1.0, we should send a delta of 120 == 1 line, which we then map to 10 pixels based on QPlatformTheme::ThemeHint::WheelScrollLines
- "When hasPreciseScrollingDeltas is NO, multiply the value returned by this method by the line or row height. Otherwise scroll by the returned amount."
- NSEvent.scrollingDeltaY
- Windows
- QWheelEvent
- angleDelta
- "Returns the relative amount that the wheel was rotated, in eighths of a degree. "
- "Most mouse types work in steps of 15 degrees, in which case the delta value is a multiple of 120; i.e., 120 units * 1/8 = 15 degrees."
- Qt has standardized on the 15 degrees as being one "click", and that it should map to one increment (line/item)
- pixelDelta
- Simple, plain old (QtGui) pixels
- Should be preferred if !isNull()
- However the QWheelEvent overview docs say:
- "pixelDelta() returns the deltas in screen pixels, and is available on platforms that have high-resolution trackpads, such as macOS. If that is the case, device()->type() will return QInputDevice::DeviceType::Touchpad."
- If we synthesize the pixel deltas, we still want those to be preferred don't we?
- Does synthesizing the pixel deltas mean we should set source =Qt::MouseEventSynthesizedBySystem ?
- The event itself isn't synthesized, just one property of it
- "pixelDelta() returns the deltas in screen pixels, and is available on platforms that have high-resolution trackpads, such as macOS. If that is the case, device()->type() will return QInputDevice::DeviceType::Touchpad."
- However the QWheelEvent overview docs say:
- angleDelta