Repository navigation
Expand file tree
/
Copy pathGallery.qml
More file actions
163 lines (141 loc) · 5.42 KB
/
Copy pathGallery.qml
File metadata and controls
163 lines (141 loc) · 5.42 KB
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
import QtQuick
import QtQuick.Window
import QtQuick.Layouts
import "qrc:/controls"
import "qrc:/gallery"
import "qrc:/primitives"
// The control library, documented. Fully resizable: the shell is a RowLayout,
// every page is a ColumnLayout of Sections, and each Section reflows its demos
// in a Flow. Nothing has a fixed window size.
Window {
id: win
width: Math.min(1440, Screen.desktopAvailableWidth - 80)
height: Math.min(940, Screen.desktopAvailableHeight - 80)
minimumWidth: 720
minimumHeight: 520
color: "#181818"
title: qsTr("D707 Control Library")
Style { id: sty }
property color face: "#56BDB4"
property color line: Qt.rgba(1, 1, 1, 0.62)
property int currentPage: 0
// Everything in controls/ except Theme.qml, which holds tokens rather than
// drawing anything. verify.py fails the build if this drifts from the
// actual file count.
readonly property int controlCount: 45
// below this width the sidebar becomes a drawer
readonly property bool compact: width < 980
property bool drawerOpen: false
readonly property var pages: [
{ title: "Overview", icon: "info", src: "qrc:/gallery/pages/Overview.qml" },
{ title: "Buttons", icon: "play", src: "qrc:/gallery/pages/Buttons.qml" },
{ title: "Selection", icon: "check", src: "qrc:/gallery/pages/Selection.qml" },
{ title: "Inputs", icon: "search", src: "qrc:/gallery/pages/Inputs.qml" },
{ title: "Continuous", icon: "gear", src: "qrc:/gallery/pages/Continuous.qml" },
{ title: "Readouts", icon: "record", src: "qrc:/gallery/pages/Readouts.qml" },
{ title: "Containers", icon: "menu", src: "qrc:/gallery/pages/Containers.qml" },
{ title: "Navigation", icon: "chevronRight", src: "qrc:/gallery/pages/Navigation.qml" },
{ title: "Overlays", icon: "warning", src: "qrc:/gallery/pages/Overlays.qml" }
]
Rectangle {
anchors.fill: parent
color: win.face
}
ColumnLayout {
anchors.fill: parent
anchors.margins: 18
spacing: 14
// ── header rail ──────────────────────────────────────────────
RowLayout {
Layout.fillWidth: true
Layout.preferredHeight: 56
spacing: 14
IconButton {
visible: win.compact
iconName: "menu"
onClicked: win.drawerOpen = !win.drawerOpen
}
ColumnLayout {
spacing: 0
Caption {
text: "D707"
tracking: 5.9
font.pixelSize: 30
font.weight: Font.Black
color: "#FFFFFF"
}
Caption {
text: "CONTROL LIBRARY"
tracking: 4.5
font.pixelSize: 13
font.weight: Font.Light
color: sty.amber
}
}
Item { Layout.fillWidth: true }
Badge {
visible: win.width > 760
text: win.controlCount + " CONTROLS"
accent: "#FFFFFF"
solid: false
}
Badge {
visible: win.width > 900
text: "0 IMAGE ASSETS"
accent: sty.amber
solid: false
Layout.rightMargin: 4
}
}
Separator { Layout.fillWidth: true }
// ── body ─────────────────────────────────────────────────────
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
spacing: 16
Sidebar {
id: nav
visible: !win.compact
Layout.preferredWidth: 252
Layout.fillHeight: true
model: win.pages
controlCount: win.controlCount
currentIndex: win.currentPage
accent: "#FFFFFF"
onPicked: (i) => win.currentPage = i
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
Loader {
id: pageLoader
anchors.fill: parent
asynchronous: false
source: win.pages[win.currentPage].src
}
}
}
}
// ── compact drawer ───────────────────────────────────────────────
Item {
anchors.fill: parent
visible: win.compact && win.drawerOpen
z: 400
Rectangle {
anchors.fill: parent
color: Qt.rgba(0, 0, 0, 0.5)
MouseArea { anchors.fill: parent; onClicked: win.drawerOpen = false }
}
Sidebar {
width: 260
height: parent.height - 36
x: 18
y: 18
model: win.pages
controlCount: win.controlCount
currentIndex: win.currentPage
accent: "#FFFFFF"
onPicked: (i) => { win.currentPage = i; win.drawerOpen = false }
}
}
}