diff options
author | Bea Lam <bea.lam@nokia.com> | 2012-03-20 11:37:10 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-17 06:09:56 +0200 |
commit | 0d52c081a1650dc6a3a9b02c7fa5345c94ca6597 (patch) | |
tree | c0c887fc56471b28c7e238bb449fe2d14a254f84 /tests/auto/quick/qquickgridview/data | |
parent | bf55fe91ed0e6a0673f66d1792605c632b1aa99e (diff) |
Vertical layout direction for ListView and GridView
Provide verticalLayoutDirection property with TopToBottom
and BottomToTop values.
Change-Id: If6f0da5dd4735036162868d391852a661854de5b
Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickgridview/data')
4 files changed, 122 insertions, 12 deletions
diff --git a/tests/auto/quick/qquickgridview/data/gridview1.qml b/tests/auto/quick/qquickgridview/data/gridview1.qml index 4bf6f0b952..1424955689 100644 --- a/tests/auto/quick/qquickgridview/data/gridview1.qml +++ b/tests/auto/quick/qquickgridview/data/gridview1.qml @@ -26,8 +26,9 @@ Rectangle { text: index } Text { - x: 40 + x: 30 text: wrapper.x + ", " + wrapper.y + font.pixelSize: 12 } Text { y: 20 @@ -58,12 +59,11 @@ Rectangle { height: 320 cellWidth: 80 cellHeight: 60 - flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom - layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight model: testModel delegate: myDelegate header: root.showHeader ? headerFooter : null footer: root.showFooter ? headerFooter : null cacheBuffer: root.cacheBuffer + focus: true } } diff --git a/tests/auto/quick/qquickgridview/data/headerfooter.qml b/tests/auto/quick/qquickgridview/data/headerfooter.qml index 322cfed388..f0f73a0dac 100644 --- a/tests/auto/quick/qquickgridview/data/headerfooter.qml +++ b/tests/auto/quick/qquickgridview/data/headerfooter.qml @@ -2,24 +2,22 @@ import QtQuick 2.0 GridView { id: view - property bool horizontal: false - property bool rtl: false + width: 240 height: 320 model: testModel - - flow: horizontal ? GridView.TopToBottom : GridView.LeftToRight + header: Rectangle { objectName: "header" - width: horizontal ? 20 : view.width - height: horizontal ? view.height : 20 + width: flow == GridView.TopToBottom ? 20 : view.width + height: flow == GridView.TopToBottom ? view.height : 20 color: "red" } footer: Rectangle { objectName: "footer" - width: horizontal ? 30 : view.width - height: horizontal ? view.height : 30 + width: flow == GridView.TopToBottom ? 30 : view.width + height: flow == GridView.TopToBottom ? view.height : 30 color: "blue" } @@ -27,5 +25,4 @@ GridView { cellHeight: 80; delegate: Text { width: 80; height: 80; text: index + "(" + x + ")" } - layoutDirection: rtl ? Qt.RightToLeft : Qt.LeftToRight } diff --git a/tests/auto/quick/qquickgridview/data/layouts.qml b/tests/auto/quick/qquickgridview/data/layouts.qml new file mode 100644 index 0000000000..e00351f1bf --- /dev/null +++ b/tests/auto/quick/qquickgridview/data/layouts.qml @@ -0,0 +1,62 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 240 + height: 320 + + property bool showHeader: false + property bool showFooter: false + + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 80 + height: 60 + border.width: 1 + Text { text: index } + Text { + x: 30 + text: wrapper.x + ", " + wrapper.y + font.pixelSize: 12 + } + Text { + y: 20 + id: textName + objectName: "textName" + text: name + } + Text { + y: 40 + id: textNumber + objectName: "textNumber" + text: number + } + + property string theName: name + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + + Component { + id: headerFooter + Rectangle { width: 30; height: 320; color: "blue" } + } + + GridView { + objectName: "grid" + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom + layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight + verticalLayoutDirection: (testBottomToTop == true) ? GridView.BottomToTop : GridView.TopToBottom + model: testModel + delegate: myDelegate + header: root.showHeader ? headerFooter : null + footer: root.showFooter ? headerFooter : null + } +} diff --git a/tests/auto/quick/qquickgridview/data/resizegrid.qml b/tests/auto/quick/qquickgridview/data/resizegrid.qml new file mode 100644 index 0000000000..7ea2f120e8 --- /dev/null +++ b/tests/auto/quick/qquickgridview/data/resizegrid.qml @@ -0,0 +1,51 @@ +import QtQuick 2.0 + +Rectangle { + id: root + + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 80 + height: 60 + border.width: 1 + Text { text: index } + Text { + x: 30 + text: wrapper.x + ", " + wrapper.y + font.pixelSize: 12 + } + Text { + y: 20 + id: textName + objectName: "textName" + text: name + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + + // the grid is specifically placed inside another item to test a bug where + // resizing from anchor changes did not update the content pos correctly + Item { + anchors.fill: parent + + GridView { + clip: true + objectName: "grid" + anchors.fill: parent + cellWidth: 80 + cellHeight: 60 + + flow: (testTopToBottom == false) ? GridView.LeftToRight : GridView.TopToBottom + layoutDirection: (testRightToLeft == true) ? Qt.RightToLeft : Qt.LeftToRight + verticalLayoutDirection: (testBottomToTop == true) ? GridView.BottomToTop : GridView.TopToBottom + model: testModel + delegate: myDelegate + } + + } +} + |