summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_tableview.qml
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-08-14 12:07:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-22 18:29:44 +0100
commit0b575c91d3f2fcd1d22b759ab7c9b6ffe8d4cea0 (patch)
tree9c6062c2af2150913ef06258d2500a31ddca162d /tests/auto/controls/data/tst_tableview.qml
parentb5e1ed76942c1b0feb7a58db5fe9f24ce33e06f2 (diff)
downloadqtquickcontrols-0b575c91d3f2fcd1d22b759ab7c9b6ffe8d4cea0.tar.gz
TableView: added resizeToContents and resizeColumnsToContents
These are analogous to QTableView::resizeColumnToContents(i) and resizeColumnsToContents(). Double-clicking the header near a width adjustment boundary still provides a means for the user to do this if the application doesn't do it programmatically. Change-Id: Ibded0c9f255301b461dac7080901fc6065fdbe5e Reviewed-by: Caroline Chao <caroline.chao@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'tests/auto/controls/data/tst_tableview.qml')
-rw-r--r--tests/auto/controls/data/tst_tableview.qml16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index 55da1918..dd09dc5a 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -805,6 +805,22 @@ TestCase {
table.destroy()
}
+ function test_resize_columns() {
+ var component = Qt.createComponent("tableview/table_resizecolumns.qml")
+ compare(component.status, Component.Ready)
+ var table = component.createObject(container);
+ verify(table !== null, "table created is null")
+ waitForRendering(table)
+ compare(table.getColumn(0).width, 20)
+ table.getColumn(0).resizeToContents()
+ compare(table.getColumn(0).width, 50)
+ table.getColumn(0).width = 20
+ compare(table.getColumn(0).width, 20)
+ table.resizeColumnsToContents()
+ compare(table.getColumn(0).width, 50)
+ table.destroy()
+ }
+
// In TableView, drawn text = table.__currentRowItem.children[1].children[1].itemAt(0).children[0].children[0].text
function findAChild(item, name)