aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2020-12-15 23:41:25 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2021-01-13 15:33:26 +0100
commita6f2bcd4e9d39e4f7b5c919fc46378884f7b4a98 (patch)
treedf9f6cf41894eb378aa7d0a101214878dad30722
parent837b3795c237d20dfca4be46e10697e1cd300e60 (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. Pick-to: 6.0 Change-Id: I7dc7b0b390dbf055f35cca2a6c15a6075e33c0a4 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
-rw-r--r--src/quicktemplates2/qquickscrollview.cpp1
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;