Skip to content

qt/qml: Flickable scroll handling

Fatih Uzunoğlu requested to merge fuzun/vlc:qml-disable-smooth-scroll into master

Most users, including me, are not fond of smooth scrolling effect and find it annoying when mouse wheel is used. This MR adds an option to toggle smooth scrolling (standard mouse wheel induced), but the option will be removed in final version based on the feedback Pierre provided. Currently, it is used for debugging.

Qt Quick does not provide a meaningful way to disable "smooth scrolling". Hence, it is always enabled. In this merge request, an event filter is installed on Flickables in order to filter out the standard mouse wheel induced QWheelEvent and handle it manually to not let Flickable cause smooth scrolling.

It seems hard to detect that a standard mouse wheel caused the wheel event from the user side of Qt Framework. However, Qt docs and some testing suggests that checking angleDelta if it is multiple of 120 is a good approach. Checking event source if it is a synthesized event or not to distinguish touchpad and mouse wheel did not work for me on X11. But, according to what Pierre spotted by browsing through Qt code shows that Flickable properly handles touchpad and high precision wheel events (not on X platform, but maybe this is special to me). So, it should be enough to just handle the standard mouse wheel case manually.

So this solution is a little "hacky", but I have tried other approaches and this one looks and behaves better. It is unfortunate that QTBUG-83843 did not get enough attention by the Qt Quick team.

Problems:

  • ScrollBar(s) attached to Flickable behaves differently when increase()/decrease() methods are called depending on content size. For example, when content is too big, these methods cause jumps on the views. The reason of it is probably because the viewport adjustment is done by multiplying stepSize with content size. Scroll amount should be fixed and not depend on content size, naturally.
  • The fallback way, which is used when scrollbar is not available, does not work all the time. It looks like a Qt bug but I'm not certain.
Edited by Fatih Uzunoğlu

Merge request reports

Loading