diff options
Diffstat (limited to 'tests/manual/tableview/storagemodel/main.qml')
-rw-r--r-- | tests/manual/tableview/storagemodel/main.qml | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/tests/manual/tableview/storagemodel/main.qml b/tests/manual/tableview/storagemodel/main.qml index 2603fba0e2..725d7da7b0 100644 --- a/tests/manual/tableview/storagemodel/main.qml +++ b/tests/manual/tableview/storagemodel/main.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2018 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -38,13 +38,14 @@ ****************************************************************************/ import QtQuick 2.12 -import QtQuick.Window 2.3 +import QtQuick.Window 2.12 +import Qt.labs.qmlmodels 1.0 import StorageModel 0.1 Window { id: window - width: 640 - height: 480 + width: 480 + height: 300 visible: true color: "darkgray" title: "Storage Volumes" @@ -57,17 +58,62 @@ Window { model: StorageModel { } columnSpacing: 1 rowSpacing: 1 - delegate: Rectangle { - id: tableDelegate - implicitWidth: displayText.implicitWidth + 8 - implicitHeight: displayText.implicitHeight + 14 + delegate: DelegateChooser { + role: "type" + DelegateChoice { + roleValue: "Value" + delegate: Rectangle { + color: "tomato" + implicitWidth: Math.max(100, label.implicitWidth + 8) + implicitHeight: label.implicitHeight + 4 - Text { - id: displayText - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.leftMargin: 4 - text: display + Rectangle { + x: parent.width - width + width: value * parent.width / valueMax + height: parent.height + color: "white" + } + + Text { + id: label + anchors.baseline: parent.bottom + anchors.baselineOffset: -4 + anchors.left: parent.left + anchors.leftMargin: 4 + text: valueDisplay + " of " + valueMaxDisplay + " " + heading + } + } + } + DelegateChoice { + roleValue: "Flag" + // We could use a checkbox here but that would be another component (e.g. from Controls) + delegate: Rectangle { + implicitWidth: checkBox.implicitWidth + 8 + implicitHeight: checkBox.implicitHeight + 4 + Text { + id: checkBox + anchors.baseline: parent.bottom + anchors.baselineOffset: -4 + anchors.left: parent.left + anchors.leftMargin: 4 + text: (checkState ? "☑ " : "☐ ") + heading + } + } + } + DelegateChoice { + // roleValue: "String" // default delegate + delegate: Rectangle { + implicitWidth: stringLabel.implicitWidth + 8 + implicitHeight: stringLabel.implicitHeight + 4 + Text { + id: stringLabel + anchors.baseline: parent.bottom + anchors.baselineOffset: -4 + anchors.left: parent.left + anchors.leftMargin: 4 + text: display + } + } } } } |