opaque-demo-app/qml/TableViewDemo.qml

62 lines
1.2 KiB
QML

import QtQuick 2.7 //ApplicationWindow
import QtQuick.Controls 2.1 //Dialog
import QtQuick.Controls 2.12
import QtQuick 2.12
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.12
//import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 1.4 as C
import "opaque/theme"
import "opaque" as Widgets
import "opaque/fonts"
ColumnLayout {
spacing: 24
Widgets.ScalingLabel {
text: "QtQuick.Controls.TableView 1.x: Specify columns yourself"
}
C.TableView {
id: qt14tv
Layout.fillWidth: true
model: forms
C.TableViewColumn {
title: "Form"
role: "FormName"
}
C.TableViewColumn {
title: "Folder"
role: "FolderName"
}
C.TableViewColumn {
title: "Token"
role: "Token"
}
}
Widgets.ScalingLabel {
text: "QtQuick.Controls.TableView 2.x: Columns autogenerated from struct fields"
}
TableView {
Layout.fillHeight: true
Layout.fillWidth: true
height: parent.height / 2
model: forms
clip: true
delegate: Rectangle {
implicitWidth: 170
implicitHeight: 50
color: (row + column) % 2 == 1 ? Theme.backgroundMainColor : Theme.backgroundPaneColor
Widgets.ScalingLabel {
text: display
}
}
}
}