Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
5.7.0
-
Desktop Linux
Description
According to the documentations:
anchors.alignWhenCentered (default true) forces centered anchors to align to a whole pixel; if the item being centered has an odd width or height, the item will be positioned on a whole pixel rather than being placed on a half-pixel.
When width and height is real and not integer, center anchors are used, the y, x are still real, despite of anchors.alignWhenCentered is being by default true.
Possible cause of this can be, that in Qt/5.7/Src/qtdeclarative/src/quick/items/qquickanchors.cpp
static inline qreal hcenter(const QQuickItem *item) { qreal width = readWidth(item); if (QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors) { if (!QQuickAnchorsPrivate::get(anchors)->centerAligned) return width / 2; } int iw = width; if (iw % 2) return (width + 1) / 2; else return width / 2; } static inline qreal vcenter(const QQuickItem *item) { qreal height = readHeight(item); if (QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors) { if (!QQuickAnchorsPrivate::get(anchors)->centerAligned) return height / 2; } int ih = height; if (ih % 2) return (height + 1) / 2; else return height / 2; }
the result value is not rounded.
Attachments
Issue Links
- is duplicated by
-
QTBUG-95224 anchors.verticalCenter miscalculated with real height & y
-
- Closed
-