diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-12-15 23:41:25 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-01-13 15:37:15 +0000 |
commit | 0fe3583eef52c06370c874e940859fc8be029b4e (patch) | |
tree | 6a471c6a5288f66e745105485c9e875c3404facc | |
parent | e19e923f52217e82be9e11aadeacfbc917a00126 (diff) |
ScrollView: let flickable have pixelAligned set to true
A ScrollView will typically contain other controls. And
if we're using a dpr with a fraction (e.g 1.25), the
position of the controls will sometimes jitter as you
scroll. The result is that if e.g a Frame is wrapped
tight around around a Rectangle, the frame will sometimes
be outside the rectangle, and other times on top. This
is because of rounding issues when drawing the Frame
vs the Rectangle.
So let the default flickable used by a ScrollView have
pixelAligned set to true. This will give the best
cross-platform "out of the box" experience.
The developer can always choose to use his own Flickable
for ScrollView, and tweak it, if such default
behavior is not wanted.
Change-Id: I7dc7b0b390dbf055f35cca2a6c15a6075e33c0a4
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit a6f2bcd4e9d39e4f7b5c919fc46378884f7b4a98)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/quicktemplates2/qquickscrollview.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp index ae2b52d6..a94c4595 100644 --- a/src/quicktemplates2/qquickscrollview.cpp +++ b/src/quicktemplates2/qquickscrollview.cpp @@ -195,6 +195,7 @@ QQuickFlickable *QQuickScrollViewPrivate::ensureFlickable(bool content) // optimization is needed, the user can simply create his own flickable // child inside the scrollview, and control clipping on it explicit. flickable->setClip(true); + flickable->setPixelAligned(true); setFlickable(flickable, content); } return flickable; |