Improve KexiRecordNavigator’s scroll wheel sensitivity
Needs RevisionPublic

Authored by jfita on Apr 27 2020, 1:20 PM.

Details

Reviewers
staniek
piggz
Summary

KexiRecordNavigator handles mouse wheel event in horizontal direction by
moving to the next or previous record. However, it triggered the change
for every and all wheel events, even when the delta was tiny, and it
resulted in unwanted record changes.

This was particularly noticeable when using a trackpad in the report
view, that uses KexiRecordNavigator for pagination: even when trying to
keep the hand movement as vertical as possible to scroll the page, there
were a lot of times that the viewer moved to the next or previous page.

This commit, based on Qt’s QAbstractSlider, has a lower threshold for
the wheel’s delta and keeps an accumulator to smooth out consecutive
record switching.

FIXED-IN:3.2.1

Diff Detail

Repository
R71 Kexi
Branch
3.2
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25981
Build 25999: arc lint + arc unit
jfita created this revision.Apr 27 2020, 1:20 PM
Restricted Application added a project: KEXI. · View Herald TranscriptApr 27 2020, 1:20 PM
Restricted Application added a subscriber: Kexi-Devel-list. · View Herald Transcript
jfita requested review of this revision.Apr 27 2020, 1:20 PM
jfita added a comment.Apr 27 2020, 1:25 PM

Here are a couple of GIF showing the issue before and after the changes in this commit.

This is me trying to scroll a report’s page while keeping the hand movement as vertical as possible:

Notice how sometimes it would change page mid scroll
.After applying the changes, i can scroll the same report without that much care:

staniek requested changes to this revision.May 12 2020, 8:15 PM
staniek added inline comments.
src/widget/utils/kexirecordnavigator.cpp
359

It would be nice to have this algorithm explained briefly here as well as the 120 constant (it can be named too).

This revision now requires changes to proceed.May 12 2020, 8:15 PM
jfita added inline comments.May 16 2020, 8:05 PM
src/widget/utils/kexirecordnavigator.cpp
359

Quite frankly, i do not know what this 120 means. As i tried to imply in the summary, i copied this code from QAbstractSlider, the base for Qt scrollbars, so that it would work and feel like a QScrollArea.

The most relevant change in Qt’s repository related to this value, from the days of Qt 4, does not provide any insight to me as to where this value comes from.

Would a comment saying “code copied from QAbstractSlider” or the like be sufficient?