summaryrefslogtreecommitdiffstats
path: root/tests/manual/qmltheme/qml/qmltheme/main.qml
blob: 9c1bb29d0740d73a6b3a5526df4ead9c00714e53 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls.Fusion
import QtGraphs
//import QtDataVisualization
import "."

Item {
    id: mainview
    width: 1280
    height: 820

    property var customTheme: customSurfaceTheme
    property var currentGraph: surface

    Gradient {
        id: customGradient
        GradientStop { id: redstop; position: 0.0; color: "red" }
        GradientStop { id: greenstop; position: 1.0; color: "green" }
    }

    Gradient {
        id: singleGradient
        GradientStop { position: 0.0; color: "white" }
        GradientStop { position: 1.0; color: "yellow" }
    }

    Gradient {
        id: multiGradient
        GradientStop { position: 0.0; color: "white" }
        GradientStop { position: 1.0; color: "blue" }
    }

    Color {
        id: barColor
        color: "blue"
    }

    Color {
        id: surfaceColor
        color: "white"
    }

    GraphsTheme {
        id: customSurfaceTheme
        theme: GraphsTheme.Theme.QtGreen
        colorStyle: GraphsTheme.ObjectGradient
        plotAreaBackgroundColor: "gray"
        gridMainColor: "lightGray"
        multiHighlightColor: "orange"
        singleHighlightColor: "yellow"
        multiHighlightGradient: multiGradient
        singleHighlightGradient: singleGradient
    }

    GraphsTheme {
        id: customBarsTheme
        theme: GraphsTheme.Theme.UserDefined
        colorStyle: GraphsTheme.ObjectGradient
        baseColors: [barColor]
        baseGradients: [customGradient]
        plotAreaBackgroundColor: "gray"
        gridMainColor: "lightGray"
        multiHighlightColor: "orange"
        singleHighlightColor: "yellow"
        multiHighlightGradient: multiGradient
        singleHighlightGradient: singleGradient
    }

    Item {
        id: graphView
        width: mainview.width - settings.width
        height: mainview.height
        anchors.right: mainview.right;

        Surface3D {
            id: surface
            anchors.fill: graphView
            theme: customSurfaceTheme
            shadowQuality: AbstractGraph3D.ShadowQuality.None
            selectionMode: AbstractGraph3D.SelectionNone
            cameraPreset: AbstractGraph3D.CameraPreset.IsometricLeft
            msaaSamples: 4
            aspectRatio: 3.0
            visible: !graphMod.barsVisible
            shaderGridEnabled: backMod.testgridChange.checked

            Surface3DSeries {
                id: surfaceSeries
                // If you want to check with series colors, uncomment these
                // baseGradient: customGradient
                // baseColor: surfaceColor.color
                HeightMapSurfaceDataProxy {
                    heightMapFile: ":/layer_1.png"
                    autoScaleY: true
                }
                flatShadingEnabled: false
                drawMode: Surface3DSeries.DrawSurface
            }
        }

        Bars3D {
            id: bars
            anchors.fill: graphView
            theme: customBarsTheme
            shadowQuality: AbstractGraph3D.ShadowQuality.None
            selectionMode: AbstractGraph3D.SelectionItemAndRow
            cameraPreset: AbstractGraph3D.CameraPreset.IsometricLeft
            //optimizationHint: AbstractGraph3D.OptimizationHint.Legacy
            msaaSamples: 4
            aspectRatio: 3.0
            visible: graphMod.barsVisible
            shaderGridEnabled: backMod.testgridChange.checked

            Bar3DSeries {
                id: barsSeries
                // If you want to check with series colors, uncomment these
                // baseGradient: customGradient
                // baseColor: barColor.color
                ItemModelBarDataProxy {
                    id: barProxy
                    itemModel: ListModel {
                        ListElement{ coords: "0,0"; data: "20.0/10.0/4.75"; }
                        ListElement{ coords: "1,0"; data: "21.1/10.3/3.00"; }
                        ListElement{ coords: "2,0"; data: "22.5/10.7/1.24"; }
                        ListElement{ coords: "3,0"; data: "24.0/10.5/2.53"; }
                        ListElement{ coords: "0,1"; data: "20.2/11.2/3.55"; }
                        ListElement{ coords: "1,1"; data: "21.3/11.5/3.03"; }
                        ListElement{ coords: "2,1"; data: "22.6/11.7/3.46"; }
                        ListElement{ coords: "3,1"; data: "23.4/11.5/4.12"; }
                        ListElement{ coords: "0,2"; data: "20.2/12.3/3.37"; }
                        ListElement{ coords: "1,2"; data: "21.1/12.4/2.98"; }
                        ListElement{ coords: "2,2"; data: "22.5/12.1/3.33"; }
                        ListElement{ coords: "3,2"; data: "23.3/12.7/3.23"; }
                        ListElement{ coords: "0,3"; data: "20.7/13.3/5.34"; }
                        ListElement{ coords: "1,3"; data: "21.5/13.2/4.54"; }
                        ListElement{ coords: "2,3"; data: "22.4/13.6/4.65"; }
                        ListElement{ coords: "3,3"; data: "23.2/13.4/6.67"; }
                        ListElement{ coords: "0,4"; data: "20.6/15.0/6.01"; }
                        ListElement{ coords: "1,4"; data: "21.3/14.6/5.83"; }
                        ListElement{ coords: "2,4"; data: "22.5/14.8/7.32"; }
                        ListElement{ coords: "3,4"; data: "23.7/14.3/6.90"; }
                    }
                    rowRole: "coords"
                    columnRole: "coords"
                    valueRole: "data"
                    rowRolePattern: /(\d),\d/
                    columnRolePattern: /(\d),(\d)/
                    valueRolePattern: /^([^\/]*)\/([^\/]*)\/(.*)$/
                    rowRoleReplace: "\\1"
                    columnRoleReplace: "\\2"
                    valueRoleReplace: "\\3"
                }
            }
        }
    }

    TabBar {
        id: bar
        anchors.top: parent.top
        anchors.left: parent.left
        width: 200

        TabButton {
            text: qsTr("Graph")
        }
        TabButton {
            text: qsTr("Background")
        }
    }

    StackLayout {
        id: settings
        anchors.top: bar.bottom
        anchors.left: parent.left
        anchors.topMargin: 20
        anchors.leftMargin: 20
        width: 200
        currentIndex: bar.currentIndex

        GraphModifiers {id : graphMod}
        BackgroundModifiers {id: backMod}
    }
}