quasar icon indicating copy to clipboard operation
quasar copied to clipboard

QScrollArea: thumb doesn't center on mouse point for small thumbs (long content)

Open thexeos opened this issue 1 year ago • 0 comments

What happened?

When pressing on the bar (not the thumb) of QScrollArea, the content scrolls such that middle of the thumb is positioned underneath the mouse cursor. This behavior is consistent with native scrolling (although inline [non-

] scroll can behave differently).

What did you expect to happen?

It works well when there is little content inside scroll area and the thumb size is directly proportional to the size of the content. But when there is a lot of content the snapping breaks.

Reproduction URL

https://codepen.io/thexeos/pen/abrdvVL

How to reproduce?

  1. Go to reproduction link
  2. Press on scroll bar area underneath the thumb of the yellow container
  3. See how the thumb snaps to be centered on mouse pointer
  4. Now do the same with amber container
  5. Notice how the further down you click the more off-center the snapping becomes

I'll be submitting a PR shortly.

thexeos avatar May 17 '24 20:05 thexeos