From c47c502e794f7ae37c516a1db123139d9dc1270d Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 28 May 2013 13:39:00 +0200 Subject: Revise TableView API for managing the columns Replace "property list columns" with: - addColumn(column) - insertColumn(index, column) - moveColumn(from, to) - removeColumn(index) - getColumn(index) Exposing list type of property in the public API was problematic for several reasons. First of all, it limited the internal implementation too much. Secondly, modifying the list programmatically did not work as expected, and it also threw nasty warnings while reordering the columns interactively. Task-number: QTBUG-30319 Task-number: QTBUG-31028 Change-Id: I0039f7e4be2d6ee9303a4118bdf84146b6a96a05 Reviewed-by: Jens Bache-Wiig --- src/controls/TableViewColumn.qml | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/controls/TableViewColumn.qml') diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml index 919f30de..2c629dfb 100644 --- a/src/controls/TableViewColumn.qml +++ b/src/controls/TableViewColumn.qml @@ -89,4 +89,6 @@ QtObject { /*! The delegate of the column. This can be used to set the \l TableView::itemDelegate for a specific column. */ property Component delegate + + Accessible.role: Accessible.ColumnHeader } -- cgit v1.2.1 From 33850881a074f93622869cc4dc6bc77fbbc1fa0c Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 31 May 2013 13:10:02 +0200 Subject: TableView: Expand to single column and prevent multiple use This fix ensures that we can only add a TableViewColumn exactly once. It also automatically expands the column with to the viewport when only one column is in use. In addition I have disabled dragging when columnCount == 1 as it was pointless. Change-Id: Ief6011c3e58166907836bf55b0fa6643698192d2 Reviewed-by: Caroline Chao --- src/controls/TableViewColumn.qml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/controls/TableViewColumn.qml') diff --git a/src/controls/TableViewColumn.qml b/src/controls/TableViewColumn.qml index 2c629dfb..f1abc553 100644 --- a/src/controls/TableViewColumn.qml +++ b/src/controls/TableViewColumn.qml @@ -49,6 +49,10 @@ import QtQuick 2.1 */ QtObject { + + /*! \internal */ + property Item __view: null + /*! The title text of the column. */ property string title @@ -56,8 +60,10 @@ QtObject { property string role /*! The current width of the column - The default value depends on platform. */ - property int width: 160 + The default value depends on platform. If only one + column is defined, the width expands to the viewport. + */ + property int width: (__view && __view.columnCount === 1) ? __view.viewport.width : 160 /*! The visible status of the column. */ property bool visible: true -- cgit v1.2.1