Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.12
- import QtQuick.Window 2.12
- import QtQuick.Controls 2.12
- import QtQuick.Controls.Material 2.12
- import Qt.labs.qmlmodels 1.0
- ApplicationWindow {
- id: root
- width: Screen.desktopAvailableWidth
- height: Screen.desktopAvailableHeight
- visible: true
- title: qsTr("TableView")
- header: Rectangle {
- width: parent.width
- height: Screen.desktopAvailableHeight * 0.1
- color: Material.color(Material.LightBlue)
- }
- TableView {
- anchors.fill: parent
- rowHeightProvider: function (row) { return height/rows}
- columnWidthProvider: function (column) {return root.width/4}
- model: TableModel {
- id: tableModel
- rows: [
- {},
- {},
- {},
- {},
- {}
- ]
- TableModelColumn {}
- TableModelColumn {}
- TableModelColumn {}
- }
- delegate: Rectangle {
- border.width: 1
- border.color: Material.color(Material.LightBlue)
- Text {
- anchors.centerIn: parent
- text: index
- }
- }
- Component.onCompleted: {
- for (var i = 0; i < 5;++i)
- tableModel.appendRow(i)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement