summaryrefslogtreecommitdiffstats
path: root/tests/manual/tableview/abstracttablemodel/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/tableview/abstracttablemodel/main.qml')
-rw-r--r--tests/manual/tableview/abstracttablemodel/main.qml156
1 files changed, 131 insertions, 25 deletions
diff --git a/tests/manual/tableview/abstracttablemodel/main.qml b/tests/manual/tableview/abstracttablemodel/main.qml
index 52967a1a0d..4b9158f03c 100644
--- a/tests/manual/tableview/abstracttablemodel/main.qml
+++ b/tests/manual/tableview/abstracttablemodel/main.qml
@@ -37,10 +37,11 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick 2.14
import QtQuick.Window 2.3
import QtQml.Models 2.2
import TestTableModel 0.1
+import QtQuick.Controls 2.5
Window {
id: window
@@ -54,7 +55,7 @@ Window {
TestTableModel {
id: tableModel
rowCount: 200
- columnCount: 5000
+ columnCount: 200
}
Rectangle {
@@ -62,45 +63,150 @@ Window {
anchors.margins: 10
color: "darkgray"
- Row {
+ Column {
id: menu
x: 2
y: 2
- spacing: 1
- Button {
- text: "Add row"
- onClicked: tableModel.insertRows(selectedY, 1)
+
+ Row {
+ spacing: 1
+ Button {
+ text: "Add row"
+ onClicked: tableModel.insertRows(selectedY, 1)
+ }
+ Button {
+ text: "Remove row"
+ onClicked: tableModel.removeRows(selectedY, 1)
+ }
+ Button {
+ text: "Add column"
+ onClicked: tableModel.insertColumns(selectedX, 1)
+ }
+ Button {
+ text: "Remove column"
+ onClicked: tableModel.removeColumns(selectedX, 1)
+ }
}
- Button {
- text: "Remove row"
- onClicked: tableModel.removeRows(selectedY, 1)
+
+ Row {
+ spacing: 1
+ Button {
+ text: "fast-flick<br>center table"
+ onClicked: {
+ tableView.contentX += tableView.width * 1.2
+ }
+ }
+ Button {
+ text: "flick to end<br>center table"
+ onClicked: {
+ tableView.contentX = tableView.contentWidth - tableView.width
+ }
+ }
+ Button {
+ text: "fast-flick<br>headers"
+ onClicked: {
+ leftHeader.contentY += 1000
+ topHeader.contentX += 1000
+ }
+ }
+ Button {
+ text: "set/unset<br>master bindings"
+ onClicked: {
+ leftHeader.syncView = leftHeader.syncView ? null : tableView
+ topHeader.syncView = topHeader.syncView ? null : tableView
+ }
+ }
+ Button {
+ text: "inc space"
+ onClicked: {
+ tableView.columnSpacing += 1
+ tableView.rowSpacing += 1
+ }
+ }
+ }
+ Text {
+ text: "Selected: x:" + selectedX + ", y:" + selectedY
}
- Button {
- text: "Add column"
- onClicked: tableModel.insertColumns(selectedX, 1)
+ }
+
+ TableView {
+ id: topHeader
+ objectName: "topHeader"
+ anchors.left: tableView.left
+ width: tableView.width
+ anchors.top: menu.bottom
+ height: 30
+ clip: true
+ ScrollBar.horizontal: ScrollBar {}
+
+ model: TestTableModel {
+ rowCount: 1
+ columnCount: 200
}
- Button {
- text: "Remove column"
- onClicked: tableModel.removeColumns(selectedX, 1)
+
+ delegate: Rectangle {
+ implicitHeight: topHeader.height
+ implicitWidth: 20
+ color: "lightgray"
+ Text { text: column }
}
+
+ columnSpacing: 1
+ rowSpacing: 1
+
+ syncDirection: Qt.Horizontal
}
- Text {
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.margins: 2
- text: "x:" + selectedX + ", y:" + selectedY
+
+ TableView {
+ id: leftHeader
+ objectName: "leftHeader"
+ anchors.left: parent.left
+ anchors.top: tableView.top
+ height: tableView.height
+ width: 30
+ clip: true
+ ScrollBar.vertical: ScrollBar {}
+
+ model: TestTableModel {
+ rowCount: 200
+ columnCount: 1
+ }
+
+ delegate: Rectangle {
+ implicitHeight: 50
+ implicitWidth: leftHeader.width
+ color: "lightgray"
+ Text { text: row }
+ }
+
+ columnSpacing: 1
+ rowSpacing: 1
+
+ syncDirection: Qt.Vertical
}
TableView {
id: tableView
- anchors.left: parent.left
+ objectName: "tableview"
+ anchors.left: leftHeader.right
anchors.right: parent.right
- anchors.top: menu.bottom
+ anchors.top: topHeader.bottom
anchors.bottom: parent.bottom
- anchors.margins: 2
+ width: 200
clip: true
+ columnWidthProvider: function(c) {
+ if (c > 30)
+ return 100
+ else
+ return 200;
+ }
+ ScrollBar.horizontal: ScrollBar {}
+ ScrollBar.vertical: ScrollBar {}
- model: tableModel
+ model: TestTableModel {
+ rowCount: 200
+ columnCount: 60
+ }
delegate: tableViewDelegate
columnSpacing: 1
rowSpacing: 1