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

QApplication::wheelScrollLines() should respect OS settings

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Done
    • P4: Low
    • None
    • 5.5.1
    • Core: Plugins
    • None
    • Windows: 10bea194f873eedda312dd958fb8696e5ad2bb1b (qtbase/5.6, 23.11.2015, 5.6)

    Description

      Currently QApplication::wheelScrollLines() has a fixed default of 3. It would be more natural if the default would be taken from the OS.

      Solution:

      Im not too much into the internals of Qt, so I may be wrong at some point. But this is how I would do it:

      • Add WheelScrollLines to QPlatformIntegration::StyleHint.
      • As a fallback, the default value returned by QPlatformIntegration::StyleHint(QPlatformIntegration::WheelScrollLines) would still be 3.
      • Subclasses for the different OSs can override this. For example, QWindowsIntegration would handle this completely analogous to KeyboardAutoRepeatRate. The corresponding OS call is just SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &lines, 0).
      • QApplication::set/wheelScrollLines() has to persist (i.e. overwrite default settings) to maintain backward compatibility. By convention, one could use a special value of 0 or -1 to mark "Use platform settings". I.e. QApplicationPrivate::wheel_scroll_lines would default to this value and it would be allowed as an argument in QApplication::setWheelScrollLines(). QApplication::wheelScrollLines() would replace this value by the one obtained from the StyleHint, and simply pass on values > 0.

      In my eyes, this is a straight forward and extension of the current behavior.

      I've never committed code to Qt so far, therefore I've just outlined what to do. Would the chance of integration be much better if I send a patch/pull request? If so, can you please point me to a description how to do it? Thanks.

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            thoffmann Tim Hoffmann
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes