Details
-
Task
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
None
-
None
Description
QML1's border behavior of shifting the border 0.5 pixels for odd-size borders is a bit unintuitive and results in ugly workarounds such as:
Rectangle { id: intuitiveRect width: 8; height: 8 border.color: "gray" Rectangle { id: centeredRectangle anchors { fill: parent margins: 2 } } } Rectangle { id: outerBorderWorkaround width: 9; height: 9 border.color: "gray" Rectangle { id: centeredRectangle anchors { fill: parent leftMargin: 3; topMargin: 3 rightMargin: 2; bottomMargin: 2 } } } Rectangle { id: innerBorderWorkaround width: 7; height: 7 border.color: "gray" Rectangle { id: centeredRectangle anchors { fill: parent leftMargin: 3; topMargin: 3 rightMargin: 2; bottomMargin: 2 } } }
QML2 adds an alignment property that rectifies this somewhat, but an even better solution would be to represent the behavior with a type-property, where the user can also choose an explicit inner or outer border. For QML2 this is easy to implement, and has low technical risk.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-21341 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
37389,5 | Make Rectangle border be inner instead of centered on the outline. | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |