RinUI 0.0.11__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- RinUI/__init__.py +4 -4
- RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
- RinUI/assets/img/default_app_icon.png +0 -0
- RinUI/components/Base.qml +78 -78
- RinUI/components/BasicInput/Button.qml +146 -147
- RinUI/components/BasicInput/CheckBox.qml +98 -98
- RinUI/components/BasicInput/ComboBox.qml +159 -159
- RinUI/components/BasicInput/DropDownButton.qml +20 -20
- RinUI/components/BasicInput/Hyperlink.qml +17 -17
- RinUI/components/BasicInput/PillButton.qml +10 -10
- RinUI/components/BasicInput/RadioButton.qml +94 -94
- RinUI/components/BasicInput/RoundButton.qml +26 -26
- RinUI/components/BasicInput/Slider.qml +212 -212
- RinUI/components/BasicInput/Switch.qml +101 -101
- RinUI/components/BasicInput/ToggleButton.qml +10 -10
- RinUI/components/BasicInput/ToolButton.qml +30 -30
- RinUI/components/ContextMenu.qml +183 -183
- RinUI/components/DateAndTime/DatePicker.qml +142 -140
- RinUI/components/DateAndTime/PickerView.qml +223 -223
- RinUI/components/DateAndTime/TimePicker.qml +114 -114
- RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
- RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
- RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -144
- RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
- RinUI/components/FocusIndicator.qml +33 -33
- RinUI/components/IconWidget.qml +52 -52
- RinUI/components/Indicator.qml +89 -89
- RinUI/components/Layout/Expander.qml +159 -159
- RinUI/components/Layout/SettingExpander.qml +66 -66
- RinUI/components/Layout/SettingItem.qml +70 -70
- RinUI/components/ListAndCollections/Clip.qml +21 -21
- RinUI/components/ListAndCollections/Frame.qml +43 -43
- RinUI/components/ListAndCollections/ListView.qml +104 -104
- RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
- RinUI/components/ListAndCollections/SettingCard.qml +72 -72
- RinUI/components/ListAndCollections/TableView.qml +81 -81
- RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
- RinUI/components/Media/Avatar.qml +83 -0
- RinUI/components/MenusAndToolbars/Menu.qml +150 -150
- RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
- RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
- RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
- RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
- RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
- RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
- RinUI/components/Navigation/ErrorPage.qml +48 -48
- RinUI/components/Navigation/NavigationBar.qml +179 -179
- RinUI/components/Navigation/NavigationItem.qml +193 -193
- RinUI/components/Navigation/NavigationSubItem.qml +103 -103
- RinUI/components/Navigation/NavigationView.qml +228 -227
- RinUI/components/Navigation/Segmented.qml +17 -0
- RinUI/components/Navigation/SegmentedItem.qml +108 -0
- RinUI/components/Navigation/SelectorBar.qml +12 -57
- RinUI/components/Navigation/SelectorBarItem.qml +89 -0
- RinUI/components/ScrollBar.qml +204 -204
- RinUI/components/ScrollView.qml +12 -12
- RinUI/components/Shadow.qml +47 -47
- RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
- RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
- RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
- RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
- RinUI/components/StatusAndInfo/Toast.qml +236 -236
- RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
- RinUI/components/Text/SpinBox.qml +150 -133
- RinUI/components/Text/Text.qml +44 -44
- RinUI/components/Text/TextArea.qml +117 -117
- RinUI/components/Text/TextField.qml +113 -113
- RinUI/components/Text/TextInput.qml +47 -47
- RinUI/components/qmldir +80 -77
- RinUI/core/__init__.py +4 -4
- RinUI/core/config.py +129 -129
- RinUI/core/launcher.py +129 -129
- RinUI/core/theme.py +339 -339
- RinUI/core/translator.py +25 -25
- RinUI/hooks/__init__.py +3 -3
- RinUI/hooks/hook-RinUI.py +3 -3
- RinUI/qmldir +108 -97
- RinUI/themes/Appearance.qml +36 -0
- RinUI/themes/Colors.qml +36 -0
- RinUI/themes/dark.qml +145 -136
- RinUI/themes/light.qml +145 -136
- RinUI/themes/qmldir +9 -6
- RinUI/themes/theme.qml +151 -149
- RinUI/themes/utils.qml +37 -37
- RinUI/utils/Animation.qml +12 -12
- RinUI/utils/FloatLayer.qml +132 -123
- RinUI/utils/FontIconLoader.qml +13 -13
- RinUI/utils/Position.qml +19 -19
- RinUI/utils/Severity.qml +13 -13
- RinUI/utils/Typography.qml +17 -17
- RinUI/utils/qmldir +4 -4
- RinUI/windows/CtrlBtn.qml +118 -118
- RinUI/windows/FluentPage.qml +92 -92
- RinUI/windows/FluentWindow.qml +31 -30
- RinUI/windows/FluentWindowBase.qml +158 -158
- RinUI/windows/TitleBar.qml +135 -135
- RinUI/windows/qmldir +7 -7
- RinUI/windows/window/ApplicationWindow.qml +8 -8
- RinUI/windows/window/Window.qml +118 -118
- {rinui-0.0.11.data → rinui-0.1.1.data}/data/LICENSE +21 -21
- {rinui-0.0.11.data → rinui-0.1.1.data}/data/README.md +100 -97
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/METADATA +116 -112
- rinui-0.1.1.dist-info/RECORD +112 -0
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/WHEEL +1 -1
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info/licenses}/LICENSE +21 -21
- RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/config/rin_ui.json +0 -8
- RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
- rinui-0.0.11.dist-info/RECORD +0 -112
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/entry_points.txt +0 -0
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/top_level.txt +0 -0
@@ -1,193 +1,193 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls 2.15
|
3
|
-
import "../../themes"
|
4
|
-
import "../../components"
|
5
|
-
|
6
|
-
Item {
|
7
|
-
id: navigationItems
|
8
|
-
property var itemData
|
9
|
-
readonly property bool subItem: itemData.subItems && itemData.subItems.length > 0
|
10
|
-
property var currentPage
|
11
|
-
property bool highlighted: String(navigationBar.currentPage) === String(itemData.page) || (collapsed && subItemHighlighted)
|
12
|
-
|
13
|
-
property bool subItemHighlighted: {
|
14
|
-
if (!subItem) return false;
|
15
|
-
for (let i = 0; i < itemData.subItems.length; i++) {
|
16
|
-
if (String(itemData.subItems[i].page) === String(navigationBar.currentPage)) {
|
17
|
-
return true;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
return false;
|
21
|
-
}
|
22
|
-
property bool collapsed: true // 是否折叠
|
23
|
-
|
24
|
-
height: 40 + (!collapsed && subItem ? subItemsColumn.height : 0)
|
25
|
-
width: parent ? parent.width : 200
|
26
|
-
|
27
|
-
Button {
|
28
|
-
id: itemBtn
|
29
|
-
// anchors.fill: parent
|
30
|
-
width: parent.width
|
31
|
-
height: 37
|
32
|
-
anchors.topMargin: 2
|
33
|
-
anchors.bottomMargin: 2
|
34
|
-
clip: true
|
35
|
-
flat: true
|
36
|
-
accessibliityIndicator: false
|
37
|
-
background.opacity: navigationItems.highlighted ? 1 : hovered ? 1 : 0
|
38
|
-
|
39
|
-
// accessibility
|
40
|
-
FocusIndicator {
|
41
|
-
control: parent
|
42
|
-
anchors.margins: 2
|
43
|
-
}
|
44
|
-
|
45
|
-
Row {
|
46
|
-
id: left
|
47
|
-
spacing: 16
|
48
|
-
anchors.left: parent.left
|
49
|
-
anchors.verticalCenter: parent.verticalCenter
|
50
|
-
anchors.leftMargin: 11
|
51
|
-
anchors.topMargin: 6
|
52
|
-
anchors.bottomMargin: 8
|
53
|
-
|
54
|
-
IconWidget {
|
55
|
-
id: icon
|
56
|
-
anchors.verticalCenter: parent.verticalCenter
|
57
|
-
size: itemData.icon || itemData.source ? 19 : 0
|
58
|
-
icon: itemData.icon || ""
|
59
|
-
source: itemData.source || ""
|
60
|
-
}
|
61
|
-
|
62
|
-
Text {
|
63
|
-
id: text
|
64
|
-
anchors.verticalCenter: parent.verticalCenter
|
65
|
-
typography: Typography.Body
|
66
|
-
text: itemData.title
|
67
|
-
clip: true
|
68
|
-
opacity: navigationBar.collapsed ? 0 : 1
|
69
|
-
wrapMode: Text.NoWrap
|
70
|
-
horizontalAlignment: Text.AlignLeft
|
71
|
-
|
72
|
-
Behavior on x {
|
73
|
-
NumberAnimation {
|
74
|
-
duration: Utils.appearanceSpeed
|
75
|
-
easing.type: Easing.InOutQuint
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
Behavior on opacity {
|
80
|
-
NumberAnimation {
|
81
|
-
duration: Utils.appearanceSpeed
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
}
|
86
|
-
|
87
|
-
// 提示
|
88
|
-
ToolTip {
|
89
|
-
visible: navigationBar.collapsed && itemBtn.hovered
|
90
|
-
delay: 500
|
91
|
-
text: itemData.title
|
92
|
-
}
|
93
|
-
|
94
|
-
Indicator {
|
95
|
-
id: indicator
|
96
|
-
y: (itemBtn.height + 3) / 2 - indicator.height / 2 - 2
|
97
|
-
currentItemHeight: itemBtn.height + 3
|
98
|
-
visible: highlighted ? 1 : 0
|
99
|
-
width: 3
|
100
|
-
}
|
101
|
-
|
102
|
-
// 展开按钮
|
103
|
-
ToolButton {
|
104
|
-
id: expandBtn
|
105
|
-
focusPolicy: Qt.NoFocus
|
106
|
-
anchors.right: parent.right
|
107
|
-
anchors.verticalCenter: parent.verticalCenter
|
108
|
-
width: parent.height
|
109
|
-
height: parent.height
|
110
|
-
hoverable: false
|
111
|
-
size: 14
|
112
|
-
icon.name: "ic_fluent_chevron_down_20_filled"
|
113
|
-
accessibliityIndicator: false
|
114
|
-
|
115
|
-
FocusIndicator {
|
116
|
-
control: parent
|
117
|
-
anchors.margins: 2
|
118
|
-
}
|
119
|
-
|
120
|
-
transform: Rotation {
|
121
|
-
angle: collapsed ? 0 : 180 ; origin.x: 37/2; origin.y: 37/2
|
122
|
-
Behavior on angle { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
123
|
-
}
|
124
|
-
|
125
|
-
visible: subItem && !navigationBar.collapsed
|
126
|
-
opacity: 0.7
|
127
|
-
|
128
|
-
onClicked: { collapsed = !collapsed }
|
129
|
-
}
|
130
|
-
|
131
|
-
onClicked: {
|
132
|
-
if (subItem) {
|
133
|
-
if (!navigationBar.collapsed) {
|
134
|
-
collapsed = !collapsed
|
135
|
-
} else {
|
136
|
-
subMenu.open()
|
137
|
-
}
|
138
|
-
}
|
139
|
-
if (itemData.page && currentPage && !navigationItems.highlighted) {
|
140
|
-
// 记录上一次的索引
|
141
|
-
navigationView.safePush(itemData.page, true)
|
142
|
-
}
|
143
|
-
}
|
144
|
-
}
|
145
|
-
|
146
|
-
// 动画 / Animation //
|
147
|
-
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
148
|
-
|
149
|
-
// 折叠菜单
|
150
|
-
Menu {
|
151
|
-
id: subMenu
|
152
|
-
position: Position.Right
|
153
|
-
Repeater {
|
154
|
-
id: subMenuRepeater
|
155
|
-
model: itemData.subItems
|
156
|
-
delegate: MenuItem {
|
157
|
-
text: modelData.title
|
158
|
-
onClicked: {
|
159
|
-
if (modelData.page && navigationItems.currentPage) {
|
160
|
-
navigationView.safePush(modelData.page)
|
161
|
-
}
|
162
|
-
}
|
163
|
-
}
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
// 递归处理子项
|
168
|
-
Column {
|
169
|
-
id: subItemsColumn
|
170
|
-
opacity: !collapsed && subItem
|
171
|
-
spacing: 2
|
172
|
-
anchors.top: itemBtn.bottom
|
173
|
-
width: parent.width
|
174
|
-
anchors.topMargin: 1
|
175
|
-
anchors.leftMargin: 16
|
176
|
-
Behavior on opacity { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
177
|
-
|
178
|
-
Repeater {
|
179
|
-
id: subItemsRepeater
|
180
|
-
model: itemData.subItems
|
181
|
-
delegate: NavigationSubItem {
|
182
|
-
id: subItems
|
183
|
-
itemData: modelData
|
184
|
-
currentPage: navigationItems.currentPage
|
185
|
-
}
|
186
|
-
}
|
187
|
-
|
188
|
-
Item {
|
189
|
-
width: parent.width
|
190
|
-
height: 1
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
Item {
|
7
|
+
id: navigationItems
|
8
|
+
property var itemData
|
9
|
+
readonly property bool subItem: itemData.subItems && itemData.subItems.length > 0
|
10
|
+
property var currentPage
|
11
|
+
property bool highlighted: String(navigationBar.currentPage) === String(itemData.page) || (collapsed && subItemHighlighted)
|
12
|
+
|
13
|
+
property bool subItemHighlighted: {
|
14
|
+
if (!subItem) return false;
|
15
|
+
for (let i = 0; i < itemData.subItems.length; i++) {
|
16
|
+
if (String(itemData.subItems[i].page) === String(navigationBar.currentPage)) {
|
17
|
+
return true;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
return false;
|
21
|
+
}
|
22
|
+
property bool collapsed: true // 是否折叠
|
23
|
+
|
24
|
+
height: 40 + (!collapsed && subItem ? subItemsColumn.height : 0)
|
25
|
+
width: parent ? parent.width : 200
|
26
|
+
|
27
|
+
Button {
|
28
|
+
id: itemBtn
|
29
|
+
// anchors.fill: parent
|
30
|
+
width: parent.width
|
31
|
+
height: 37
|
32
|
+
anchors.topMargin: 2
|
33
|
+
anchors.bottomMargin: 2
|
34
|
+
clip: true
|
35
|
+
flat: true
|
36
|
+
accessibliityIndicator: false
|
37
|
+
background.opacity: navigationItems.highlighted ? 1 : hovered ? 1 : 0
|
38
|
+
|
39
|
+
// accessibility
|
40
|
+
FocusIndicator {
|
41
|
+
control: parent
|
42
|
+
anchors.margins: 2
|
43
|
+
}
|
44
|
+
|
45
|
+
Row {
|
46
|
+
id: left
|
47
|
+
spacing: 16
|
48
|
+
anchors.left: parent.left
|
49
|
+
anchors.verticalCenter: parent.verticalCenter
|
50
|
+
anchors.leftMargin: 11
|
51
|
+
anchors.topMargin: 6
|
52
|
+
anchors.bottomMargin: 8
|
53
|
+
|
54
|
+
IconWidget {
|
55
|
+
id: icon
|
56
|
+
anchors.verticalCenter: parent.verticalCenter
|
57
|
+
size: itemData.icon || itemData.source ? 19 : 0
|
58
|
+
icon: itemData.icon || ""
|
59
|
+
source: itemData.source || ""
|
60
|
+
}
|
61
|
+
|
62
|
+
Text {
|
63
|
+
id: text
|
64
|
+
anchors.verticalCenter: parent.verticalCenter
|
65
|
+
typography: Typography.Body
|
66
|
+
text: itemData.title
|
67
|
+
clip: true
|
68
|
+
opacity: navigationBar.collapsed ? 0 : 1
|
69
|
+
wrapMode: Text.NoWrap
|
70
|
+
horizontalAlignment: Text.AlignLeft
|
71
|
+
|
72
|
+
Behavior on x {
|
73
|
+
NumberAnimation {
|
74
|
+
duration: Utils.appearanceSpeed
|
75
|
+
easing.type: Easing.InOutQuint
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
Behavior on opacity {
|
80
|
+
NumberAnimation {
|
81
|
+
duration: Utils.appearanceSpeed
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
// 提示
|
88
|
+
ToolTip {
|
89
|
+
visible: navigationBar.collapsed && itemBtn.hovered
|
90
|
+
delay: 500
|
91
|
+
text: itemData.title
|
92
|
+
}
|
93
|
+
|
94
|
+
Indicator {
|
95
|
+
id: indicator
|
96
|
+
y: (itemBtn.height + 3) / 2 - indicator.height / 2 - 2
|
97
|
+
currentItemHeight: itemBtn.height + 3
|
98
|
+
visible: highlighted ? 1 : 0
|
99
|
+
width: 3
|
100
|
+
}
|
101
|
+
|
102
|
+
// 展开按钮
|
103
|
+
ToolButton {
|
104
|
+
id: expandBtn
|
105
|
+
focusPolicy: Qt.NoFocus
|
106
|
+
anchors.right: parent.right
|
107
|
+
anchors.verticalCenter: parent.verticalCenter
|
108
|
+
width: parent.height
|
109
|
+
height: parent.height
|
110
|
+
hoverable: false
|
111
|
+
size: 14
|
112
|
+
icon.name: "ic_fluent_chevron_down_20_filled"
|
113
|
+
accessibliityIndicator: false
|
114
|
+
|
115
|
+
FocusIndicator {
|
116
|
+
control: parent
|
117
|
+
anchors.margins: 2
|
118
|
+
}
|
119
|
+
|
120
|
+
transform: Rotation {
|
121
|
+
angle: collapsed ? 0 : 180 ; origin.x: 37/2; origin.y: 37/2
|
122
|
+
Behavior on angle { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
123
|
+
}
|
124
|
+
|
125
|
+
visible: subItem && !navigationBar.collapsed
|
126
|
+
opacity: 0.7
|
127
|
+
|
128
|
+
onClicked: { collapsed = !collapsed }
|
129
|
+
}
|
130
|
+
|
131
|
+
onClicked: {
|
132
|
+
if (subItem) {
|
133
|
+
if (!navigationBar.collapsed) {
|
134
|
+
collapsed = !collapsed
|
135
|
+
} else {
|
136
|
+
subMenu.open()
|
137
|
+
}
|
138
|
+
}
|
139
|
+
if (itemData.page && currentPage && !navigationItems.highlighted) {
|
140
|
+
// 记录上一次的索引
|
141
|
+
navigationView.safePush(itemData.page, true)
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
// 动画 / Animation //
|
147
|
+
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
148
|
+
|
149
|
+
// 折叠菜单
|
150
|
+
Menu {
|
151
|
+
id: subMenu
|
152
|
+
position: Position.Right
|
153
|
+
Repeater {
|
154
|
+
id: subMenuRepeater
|
155
|
+
model: itemData.subItems
|
156
|
+
delegate: MenuItem {
|
157
|
+
text: modelData.title
|
158
|
+
onClicked: {
|
159
|
+
if (modelData.page && navigationItems.currentPage) {
|
160
|
+
navigationView.safePush(modelData.page)
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
// 递归处理子项
|
168
|
+
Column {
|
169
|
+
id: subItemsColumn
|
170
|
+
opacity: !collapsed && subItem
|
171
|
+
spacing: 2
|
172
|
+
anchors.top: itemBtn.bottom
|
173
|
+
width: parent.width
|
174
|
+
anchors.topMargin: 1
|
175
|
+
anchors.leftMargin: 16
|
176
|
+
Behavior on opacity { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
177
|
+
|
178
|
+
Repeater {
|
179
|
+
id: subItemsRepeater
|
180
|
+
model: itemData.subItems
|
181
|
+
delegate: NavigationSubItem {
|
182
|
+
id: subItems
|
183
|
+
itemData: modelData
|
184
|
+
currentPage: navigationItems.currentPage
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
Item {
|
189
|
+
width: parent.width
|
190
|
+
height: 1
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
@@ -1,103 +1,103 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import QtQuick.Controls 2.15
|
3
|
-
import "../../themes"
|
4
|
-
import "../../components"
|
5
|
-
|
6
|
-
|
7
|
-
ItemDelegate {
|
8
|
-
id: root
|
9
|
-
property var itemData
|
10
|
-
property int parentIndex: -1
|
11
|
-
property var currentPage
|
12
|
-
highlighted: String(navigationBar.currentPage) === String(itemData.page)
|
13
|
-
|
14
|
-
height: 40
|
15
|
-
|
16
|
-
focusPolicy: collapsed ? Qt.NoFocus : Qt.StrongFocus // to get keyboard focus
|
17
|
-
|
18
|
-
// accessibility
|
19
|
-
FocusIndicator {
|
20
|
-
control: parent
|
21
|
-
anchors.margins: 2
|
22
|
-
}
|
23
|
-
|
24
|
-
width: parent ? parent.width : 200
|
25
|
-
|
26
|
-
background: Rectangle {
|
27
|
-
id: itemBg
|
28
|
-
anchors.fill: parent
|
29
|
-
anchors.topMargin: 2
|
30
|
-
anchors.bottomMargin: 2
|
31
|
-
clip: true
|
32
|
-
radius: Theme.currentTheme.appearance.buttonRadius / 2
|
33
|
-
color: pressed
|
34
|
-
? Theme.currentTheme.colors.subtleTertiaryColor
|
35
|
-
: (root.highlighted || root.hovered)
|
36
|
-
? Theme.currentTheme.colors.subtleSecondaryColor
|
37
|
-
: Theme.currentTheme.colors.subtleColor
|
38
|
-
|
39
|
-
Row {
|
40
|
-
id: left
|
41
|
-
spacing: 16
|
42
|
-
anchors.left: parent.left
|
43
|
-
anchors.verticalCenter: parent.verticalCenter
|
44
|
-
anchors.leftMargin: 11 + 34
|
45
|
-
anchors.topMargin: 6
|
46
|
-
anchors.bottomMargin: 8
|
47
|
-
|
48
|
-
IconWidget {
|
49
|
-
id: icon
|
50
|
-
anchors.verticalCenter: parent.verticalCenter
|
51
|
-
size: itemData.icon || itemData.source ? 19 : 0
|
52
|
-
icon: itemData.icon || ""
|
53
|
-
source: itemData.source || ""
|
54
|
-
}
|
55
|
-
|
56
|
-
Text {
|
57
|
-
id: text
|
58
|
-
anchors.verticalCenter: parent.verticalCenter
|
59
|
-
typography: Typography.Body
|
60
|
-
text: itemData.title
|
61
|
-
clip: true
|
62
|
-
opacity: navigationBar.collapsed ? 0 : 1
|
63
|
-
wrapMode: Text.NoWrap
|
64
|
-
horizontalAlignment: Text.AlignLeft
|
65
|
-
|
66
|
-
Behavior on x {
|
67
|
-
NumberAnimation {
|
68
|
-
duration: Utils.appearanceSpeed
|
69
|
-
easing.type: Easing.InOutQuint
|
70
|
-
}
|
71
|
-
}
|
72
|
-
|
73
|
-
Behavior on opacity {
|
74
|
-
NumberAnimation {
|
75
|
-
duration: Utils.appearanceSpeed
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
Indicator {
|
82
|
-
id: indicator
|
83
|
-
y: root.height / 2 - indicator.height / 2 -2
|
84
|
-
currentItemHeight: root.height
|
85
|
-
visible: highlighted ? 1 : 0
|
86
|
-
width: 3
|
87
|
-
}
|
88
|
-
|
89
|
-
Behavior on color {
|
90
|
-
ColorAnimation {
|
91
|
-
duration: Utils.appearanceSpeed
|
92
|
-
easing.type: Easing.InOutQuart
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
onClicked: {
|
98
|
-
if (itemData.page && currentPage && !root.highlighted && !collapsed) {
|
99
|
-
// 记录上一次的索引
|
100
|
-
navigationView.safePush(itemData.page)
|
101
|
-
}
|
102
|
-
}
|
103
|
-
}
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
|
7
|
+
ItemDelegate {
|
8
|
+
id: root
|
9
|
+
property var itemData
|
10
|
+
property int parentIndex: -1
|
11
|
+
property var currentPage
|
12
|
+
highlighted: String(navigationBar.currentPage) === String(itemData.page)
|
13
|
+
|
14
|
+
height: 40
|
15
|
+
|
16
|
+
focusPolicy: collapsed ? Qt.NoFocus : Qt.StrongFocus // to get keyboard focus
|
17
|
+
|
18
|
+
// accessibility
|
19
|
+
FocusIndicator {
|
20
|
+
control: parent
|
21
|
+
anchors.margins: 2
|
22
|
+
}
|
23
|
+
|
24
|
+
width: parent ? parent.width : 200
|
25
|
+
|
26
|
+
background: Rectangle {
|
27
|
+
id: itemBg
|
28
|
+
anchors.fill: parent
|
29
|
+
anchors.topMargin: 2
|
30
|
+
anchors.bottomMargin: 2
|
31
|
+
clip: true
|
32
|
+
radius: Theme.currentTheme.appearance.buttonRadius / 2
|
33
|
+
color: pressed
|
34
|
+
? Theme.currentTheme.colors.subtleTertiaryColor
|
35
|
+
: (root.highlighted || root.hovered)
|
36
|
+
? Theme.currentTheme.colors.subtleSecondaryColor
|
37
|
+
: Theme.currentTheme.colors.subtleColor
|
38
|
+
|
39
|
+
Row {
|
40
|
+
id: left
|
41
|
+
spacing: 16
|
42
|
+
anchors.left: parent.left
|
43
|
+
anchors.verticalCenter: parent.verticalCenter
|
44
|
+
anchors.leftMargin: 11 + 34
|
45
|
+
anchors.topMargin: 6
|
46
|
+
anchors.bottomMargin: 8
|
47
|
+
|
48
|
+
IconWidget {
|
49
|
+
id: icon
|
50
|
+
anchors.verticalCenter: parent.verticalCenter
|
51
|
+
size: itemData.icon || itemData.source ? 19 : 0
|
52
|
+
icon: itemData.icon || ""
|
53
|
+
source: itemData.source || ""
|
54
|
+
}
|
55
|
+
|
56
|
+
Text {
|
57
|
+
id: text
|
58
|
+
anchors.verticalCenter: parent.verticalCenter
|
59
|
+
typography: Typography.Body
|
60
|
+
text: itemData.title
|
61
|
+
clip: true
|
62
|
+
opacity: navigationBar.collapsed ? 0 : 1
|
63
|
+
wrapMode: Text.NoWrap
|
64
|
+
horizontalAlignment: Text.AlignLeft
|
65
|
+
|
66
|
+
Behavior on x {
|
67
|
+
NumberAnimation {
|
68
|
+
duration: Utils.appearanceSpeed
|
69
|
+
easing.type: Easing.InOutQuint
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
Behavior on opacity {
|
74
|
+
NumberAnimation {
|
75
|
+
duration: Utils.appearanceSpeed
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
Indicator {
|
82
|
+
id: indicator
|
83
|
+
y: root.height / 2 - indicator.height / 2 -2
|
84
|
+
currentItemHeight: root.height
|
85
|
+
visible: highlighted ? 1 : 0
|
86
|
+
width: 3
|
87
|
+
}
|
88
|
+
|
89
|
+
Behavior on color {
|
90
|
+
ColorAnimation {
|
91
|
+
duration: Utils.appearanceSpeed
|
92
|
+
easing.type: Easing.InOutQuart
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
onClicked: {
|
98
|
+
if (itemData.page && currentPage && !root.highlighted && !collapsed) {
|
99
|
+
// 记录上一次的索引
|
100
|
+
navigationView.safePush(itemData.page)
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|