summaryrefslogtreecommitdiff
path: root/src/controls/TableViewColumn.qml
diff options
context:
space:
mode:
authorJens Bache-Wiig <jens.bache-wiig@digia.com>2013-05-31 13:10:02 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-31 14:06:47 +0200
commit33850881a074f93622869cc4dc6bc77fbbc1fa0c (patch)
tree894d206769d84eaf188b5a497ee03d7cd99e78ac /src/controls/TableViewColumn.qml
parent0155e0833c56ccd21ca5668eb1be8b359400535b (diff)
downloadqtquickcontrols-33850881a074f93622869cc4dc6bc77fbbc1fa0c.tar.gz
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 <caroline.chao@digia.com>
Diffstat (limited to 'src/controls/TableViewColumn.qml')
-rw-r--r--src/controls/TableViewColumn.qml10
1 files changed, 8 insertions, 2 deletions
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