Warning, /libraries/kqtquickcharts/demo/dynamicdata/ChartTableView.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2014 Sebastian Gottfried <sebastiangottfried@web.de> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) version 3, or any 0008 * later version accepted by the membership of KDE e.V. (or its 0009 * successor approved by the membership of KDE e.V.), which shall 0010 * act as a proxy defined in Section 6 of version 3 of the license. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Lesser General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Lesser General Public 0018 */ 0019 0020 import QtQuick 2.2 0021 import org.kde.charts 0.1 0022 0023 Rectangle { 0024 id: root 0025 property Item chart 0026 0027 width: chart.model.columns * (listView.cellWidth + listView.spacing) + listView.spacing 0028 0029 color: "#fff" 0030 0031 ListView { 0032 id: listView 0033 anchors { 0034 fill: parent 0035 leftMargin: spacing 0036 topMargin: spacing 0037 bottomMargin: spacing 0038 } 0039 clip: true 0040 model: root.chart.model.rows 0041 0042 property real cellHeight: 30 0043 property real cellWidth: 4 * cellHeight 0044 spacing: 3 0045 0046 header: Component { 0047 Row { 0048 spacing: 3 0049 height: childrenRect.height + listView.spacing 0050 Repeater { 0051 model: root.chart.dimensions.length 0052 Rectangle { 0053 color: "#bbb" 0054 height: listView.cellHeight 0055 width: listView.cellWidth 0056 LegendItem { 0057 anchors.centerIn: parent 0058 dimension: root.chart.dimensions[index] 0059 } 0060 } 0061 0062 } 0063 } 0064 } 0065 0066 delegate: Row { 0067 id: rowDelegate 0068 property int row: index 0069 height: childrenRect.height 0070 spacing: 3 0071 Repeater { 0072 model: chart.model.columns 0073 ValueEdit { 0074 id: cell 0075 property int column: index 0076 height: listView.cellHeight 0077 width: listView.cellWidth 0078 value: root.chart.model.value(row, column) 0079 onValueChanged: { 0080 if (root.chart.model.value(row, column) != value) { 0081 root.chart.model.setValue(row, column, value) 0082 } 0083 } 0084 Connections { 0085 target: root.chart.model 0086 onRecordChanged: { 0087 if (row == rowDelegate.row) { 0088 cell.value = root.chart.model.value(row, column) 0089 } 0090 } 0091 } 0092 } 0093 } 0094 } 0095 } 0096 }