diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-05-04 12:48:42 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-05-28 09:29:47 +0000 |
commit | 7dc48bb0b56de00faab2d67570c74f0512991263 (patch) | |
tree | 02176c42c3c630bea9fb1646a900bf8f3f35f1b1 /tests/manual | |
parent | 61bbac145a6d69ab07e74b2f54ba1257bd6c3721 (diff) |
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 <mitch.curtis@qt.io>
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/tableview/abstracttablemodel/main.qml | 4 | ||||
-rw-r--r-- | tests/manual/tableview/listmodel/main.qml | 4 | ||||
-rw-r--r-- | tests/manual/tableview/storagemodel/main.qml | 4 |
3 files changed, 6 insertions, 6 deletions
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 |