Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ApplicationWindow {
- id: appWindow
- title: qsTr("Permissions")
- width: 640
- height: 480
- ListModel {
- id: permissionsModel
- ListElement { name: "Table 1"; read: true; add: true; edit: false }
- ListElement { name: "Users"; read: true; add: true; remove: true; edit: true }
- }
- Component {
- id: checkBoxDelegate
- Item {
- CheckBox {
- anchors.fill: parent
- checked: styleData.value
- }
- }
- }
- Component {
- id: verticalHeaderDelegate
- Item {
- Loader {
- property QtObject styleData: QtObject {
- property string value: styleData.value
- property bool pressed
- property bool containsMouse
- property int column
- }
- anchors.fill: parent
- sourceComponent: table.headerDelegate
- }
- }
- }
- Component {
- id: rowDelegate
- Item {
- Loader {
- anchors.fill: parent
- //sourceComponent: table.rowDelegate // "The program has unexpectedly finished."
- }
- Component.onCompleted: height = 1.2*height // Bad
- }
- }
- TableView {
- id: table
- property int columnWidth: width/columnCount - 1 // Bad
- anchors.fill: parent
- model: permissionsModel
- rowDelegate: rowDelegate
- TableViewColumn { title: "Permission"; delegate: verticalHeaderDelegate; role: "name"; width: table.columnWidth }
- TableViewColumn { title: "Read"; delegate: checkBoxDelegate; role: "read"; width: table.columnWidth }
- TableViewColumn { title: "Add"; delegate: checkBoxDelegate; role: "add"; width: table.columnWidth }
- TableViewColumn { title: "Remove"; delegate: checkBoxDelegate; role: "remove"; width: table.columnWidth }
- TableViewColumn { title: "Modify"; delegate: checkBoxDelegate; role: "edit"; width: table.columnWidth }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement