From 7dc48bb0b56de00faab2d67570c74f0512991263 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 4 May 2018 12:48:42 +0200 Subject: TableView: switch to use TableView.cellWidth/cellHeight This is logically more correct since TableView will override width / height anyway to make the delegates fit into the table if they are not as wide/tall as the widest column/row. And it gets even more problematic when we recycle delegates, since in that case we need to keep the original width binding of the delegate to calulate the size of new columns. And this all fits better by using attached properties instead. Change-Id: Ia5f2acd2bfc45f3fb160c3782191ad8da9f780e6 Reviewed-by: Mitch Curtis Reviewed-by: J-P Nurmi --- tests/manual/tableview/abstracttablemodel/main.qml | 4 ++-- tests/manual/tableview/listmodel/main.qml | 4 ++-- tests/manual/tableview/storagemodel/main.qml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/manual') diff --git a/tests/manual/tableview/abstracttablemodel/main.qml b/tests/manual/tableview/abstracttablemodel/main.qml index bff851a9f2..c448815a7c 100644 --- a/tests/manual/tableview/abstracttablemodel/main.qml +++ b/tests/manual/tableview/abstracttablemodel/main.qml @@ -76,8 +76,8 @@ Window { Component { id: tableViewDelegate Rectangle { - width: TableView.column % 3 ? 80 : 50 - height: TableView.row % 3 ? 80 : 50 + TableView.cellWidth: TableView.column % 3 ? 80 : 50 + TableView.cellHeight: TableView.row % 3 ? 80 : 50 Text { anchors.centerIn: parent diff --git a/tests/manual/tableview/listmodel/main.qml b/tests/manual/tableview/listmodel/main.qml index f4def85455..b5a1ab8379 100644 --- a/tests/manual/tableview/listmodel/main.qml +++ b/tests/manual/tableview/listmodel/main.qml @@ -72,8 +72,8 @@ Window { delegate: Component { Rectangle { id: tableDelegate - width: 100 - height: 50 + TableView.cellWidth: 100 + TableView.cellHeight: 50 Text { anchors.centerIn: parent diff --git a/tests/manual/tableview/storagemodel/main.qml b/tests/manual/tableview/storagemodel/main.qml index fbeb5f6115..f76da374e3 100644 --- a/tests/manual/tableview/storagemodel/main.qml +++ b/tests/manual/tableview/storagemodel/main.qml @@ -60,8 +60,8 @@ Window { rowSpacing: 1 delegate: Rectangle { id: tableDelegate - width: displayText.implicitWidth + 8 - height: displayText.implicitHeight + 14 + TableView.cellWidth: displayText.implicitWidth + 8 + TableView.cellHeight: displayText.implicitHeight + 14 Text { id: displayText -- cgit v1.2.3