summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tableview
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-05-28 13:39:00 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-29 12:36:26 +0200
commitc47c502e794f7ae37c516a1db123139d9dc1270d (patch)
tree4d109fdc40a588ec326497ecdd466c4b44fcb890 /tests/auto/controls/data/tableview
parent10851004e327f4ab798753c645ab987f10160100 (diff)
downloadqtquickcontrols-c47c502e794f7ae37c516a1db123139d9dc1270d.tar.gz
Revise TableView API for managing the columns
Replace "property list<TableViewColumn> columns" with: - addColumn(column) - insertColumn(index, column) - moveColumn(from, to) - removeColumn(index) - getColumn(index) Exposing list<TableViewColumn> 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 <jens.bache-wiig@digia.com>
Diffstat (limited to 'tests/auto/controls/data/tableview')
-rw-r--r--tests/auto/controls/data/tableview/table_dynamiccolumns.qml65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tableview/table_dynamiccolumns.qml b/tests/auto/controls/data/tableview/table_dynamiccolumns.qml
new file mode 100644
index 00000000..ce2cb93c
--- /dev/null
+++ b/tests/auto/controls/data/tableview/table_dynamiccolumns.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+** of its contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+
+TableView {
+ id: tableView
+
+ TableViewColumn { title: "static" }
+
+ Component {
+ id: component
+ TableViewColumn { }
+ }
+
+ Component.onCompleted: {
+ addColumn(component.createObject(tableView, {title: "added item"}))
+
+ var col1 = addColumn(component)
+ col1.title = "added component"
+
+ insertColumn(0, component.createObject(tableView, {title: "inserted item"}))
+
+ var col2 = insertColumn(0, component)
+ col2.title = "inserted component"
+ }
+}