aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview2/data/delegateChooserEnumRole.qml
blob: 655900d9dedfd2651a1c776f305f17f07633cb78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

import QtQuick
import Qt.labs.qmlmodels
import Test

ListView {
    width: 300; height: 300
    model: TypeRoleModel {}
    delegate: DelegateChooser {
        role: "type"
        DelegateChoice {
            roleValue: 0
            Text {
                property int delegateType: 0
                text: model.text + " of type " + model.type
            }
        }
        DelegateChoice {
            roleValue: "Markdown"
            Text {
                property int delegateType: 1
                text: model.text + " of **type** " + model.type
                textFormat: Text.MarkdownText
            }
        }
        DelegateChoice {
            roleValue: TypeRoleModel.Rect
            Rectangle {
                property int delegateType: 2
                width: 300; height: 20
                color: "wheat"
                Text {
                    text: model.text + " of type " + model.type
                    anchors.verticalCenter: parent.verticalCenter
                }
            }
        }
    }
}