diff options
author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-05-14 12:34:06 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-14 13:11:36 +0200 |
commit | 05b75bcea1a2d377584f360f28a66084b2cf8970 (patch) | |
tree | a8816d94c4e3ab1bac51c5c3fb1740fdd2cf944b /tests/auto/controls/data/tst_rowlayout.qml | |
parent | 8b1a05e8d49e8cdc4caff1737c46f50a029d8add (diff) | |
download | qtquickcontrols-05b75bcea1a2d377584f360f28a66084b2cf8970.tar.gz qtquickcontrols-05b75bcea1a2d377584f360f28a66084b2cf8970.tar.bz2 qtquickcontrols-05b75bcea1a2d377584f360f28a66084b2cf8970.zip |
Quick Layouts: Do not arrange items at sub-pixel positions.
Positioning an item to a sub-pixel position might cause the item to
not appear as crisp as it should be.
To prevent this, the layout will round off the position and size to the
nearest integer.
Task-number: QTBUG-31038
Change-Id: Id07b9ed5adc64e07f08f1abe0f37716101b01456
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'tests/auto/controls/data/tst_rowlayout.qml')
-rw-r--r-- | tests/auto/controls/data/tst_rowlayout.qml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_rowlayout.qml b/tests/auto/controls/data/tst_rowlayout.qml index 1b9573e0..505b3517 100644 --- a/tests/auto/controls/data/tst_rowlayout.qml +++ b/tests/auto/controls/data/tst_rowlayout.qml @@ -543,5 +543,36 @@ Item { layout.destroy(); } + + + Component { + id: layout_alignToPixelGrid_Component + RowLayout { + spacing: 2 + Rectangle { + implicitWidth: 10 + implicitHeight: 10 + Layout.alignment: Qt.AlignVCenter + } + Rectangle { + implicitWidth: 10 + implicitHeight: 10 + Layout.alignment: Qt.AlignVCenter + } + } + } + function test_alignToPixelGrid() + { + var layout = layout_alignToPixelGrid_Component.createObject(container) + layout.width = 21 + layout.height = 21 + var r0 = layout.children[0] + compare(r0.x, 0) // 0.0 + compare(r0.y, 6) // 5.5 + var r1 = layout.children[1] + compare(r1.x, 12) // 11.5 + compare(r1.y, 6) // 5.5 + layout.destroy(); + } } } |