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.
Files changed (115) hide show
  1. RinUI/__init__.py +4 -4
  2. RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
  3. RinUI/assets/img/default_app_icon.png +0 -0
  4. RinUI/components/Base.qml +78 -78
  5. RinUI/components/BasicInput/Button.qml +146 -147
  6. RinUI/components/BasicInput/CheckBox.qml +98 -98
  7. RinUI/components/BasicInput/ComboBox.qml +159 -159
  8. RinUI/components/BasicInput/DropDownButton.qml +20 -20
  9. RinUI/components/BasicInput/Hyperlink.qml +17 -17
  10. RinUI/components/BasicInput/PillButton.qml +10 -10
  11. RinUI/components/BasicInput/RadioButton.qml +94 -94
  12. RinUI/components/BasicInput/RoundButton.qml +26 -26
  13. RinUI/components/BasicInput/Slider.qml +212 -212
  14. RinUI/components/BasicInput/Switch.qml +101 -101
  15. RinUI/components/BasicInput/ToggleButton.qml +10 -10
  16. RinUI/components/BasicInput/ToolButton.qml +30 -30
  17. RinUI/components/ContextMenu.qml +183 -183
  18. RinUI/components/DateAndTime/DatePicker.qml +142 -140
  19. RinUI/components/DateAndTime/PickerView.qml +223 -223
  20. RinUI/components/DateAndTime/TimePicker.qml +114 -114
  21. RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
  22. RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
  23. RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -144
  24. RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
  25. RinUI/components/FocusIndicator.qml +33 -33
  26. RinUI/components/IconWidget.qml +52 -52
  27. RinUI/components/Indicator.qml +89 -89
  28. RinUI/components/Layout/Expander.qml +159 -159
  29. RinUI/components/Layout/SettingExpander.qml +66 -66
  30. RinUI/components/Layout/SettingItem.qml +70 -70
  31. RinUI/components/ListAndCollections/Clip.qml +21 -21
  32. RinUI/components/ListAndCollections/Frame.qml +43 -43
  33. RinUI/components/ListAndCollections/ListView.qml +104 -104
  34. RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
  35. RinUI/components/ListAndCollections/SettingCard.qml +72 -72
  36. RinUI/components/ListAndCollections/TableView.qml +81 -81
  37. RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
  38. RinUI/components/Media/Avatar.qml +83 -0
  39. RinUI/components/MenusAndToolbars/Menu.qml +150 -150
  40. RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
  41. RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
  42. RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
  43. RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
  44. RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
  45. RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
  46. RinUI/components/Navigation/ErrorPage.qml +48 -48
  47. RinUI/components/Navigation/NavigationBar.qml +179 -179
  48. RinUI/components/Navigation/NavigationItem.qml +193 -193
  49. RinUI/components/Navigation/NavigationSubItem.qml +103 -103
  50. RinUI/components/Navigation/NavigationView.qml +228 -227
  51. RinUI/components/Navigation/Segmented.qml +17 -0
  52. RinUI/components/Navigation/SegmentedItem.qml +108 -0
  53. RinUI/components/Navigation/SelectorBar.qml +12 -57
  54. RinUI/components/Navigation/SelectorBarItem.qml +89 -0
  55. RinUI/components/ScrollBar.qml +204 -204
  56. RinUI/components/ScrollView.qml +12 -12
  57. RinUI/components/Shadow.qml +47 -47
  58. RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
  59. RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
  60. RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
  61. RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
  62. RinUI/components/StatusAndInfo/Toast.qml +236 -236
  63. RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
  64. RinUI/components/Text/SpinBox.qml +150 -133
  65. RinUI/components/Text/Text.qml +44 -44
  66. RinUI/components/Text/TextArea.qml +117 -117
  67. RinUI/components/Text/TextField.qml +113 -113
  68. RinUI/components/Text/TextInput.qml +47 -47
  69. RinUI/components/qmldir +80 -77
  70. RinUI/core/__init__.py +4 -4
  71. RinUI/core/config.py +129 -129
  72. RinUI/core/launcher.py +129 -129
  73. RinUI/core/theme.py +339 -339
  74. RinUI/core/translator.py +25 -25
  75. RinUI/hooks/__init__.py +3 -3
  76. RinUI/hooks/hook-RinUI.py +3 -3
  77. RinUI/qmldir +108 -97
  78. RinUI/themes/Appearance.qml +36 -0
  79. RinUI/themes/Colors.qml +36 -0
  80. RinUI/themes/dark.qml +145 -136
  81. RinUI/themes/light.qml +145 -136
  82. RinUI/themes/qmldir +9 -6
  83. RinUI/themes/theme.qml +151 -149
  84. RinUI/themes/utils.qml +37 -37
  85. RinUI/utils/Animation.qml +12 -12
  86. RinUI/utils/FloatLayer.qml +132 -123
  87. RinUI/utils/FontIconLoader.qml +13 -13
  88. RinUI/utils/Position.qml +19 -19
  89. RinUI/utils/Severity.qml +13 -13
  90. RinUI/utils/Typography.qml +17 -17
  91. RinUI/utils/qmldir +4 -4
  92. RinUI/windows/CtrlBtn.qml +118 -118
  93. RinUI/windows/FluentPage.qml +92 -92
  94. RinUI/windows/FluentWindow.qml +31 -30
  95. RinUI/windows/FluentWindowBase.qml +158 -158
  96. RinUI/windows/TitleBar.qml +135 -135
  97. RinUI/windows/qmldir +7 -7
  98. RinUI/windows/window/ApplicationWindow.qml +8 -8
  99. RinUI/windows/window/Window.qml +118 -118
  100. {rinui-0.0.11.data → rinui-0.1.1.data}/data/LICENSE +21 -21
  101. {rinui-0.0.11.data → rinui-0.1.1.data}/data/README.md +100 -97
  102. {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/METADATA +116 -112
  103. rinui-0.1.1.dist-info/RECORD +112 -0
  104. {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/WHEEL +1 -1
  105. {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info/licenses}/LICENSE +21 -21
  106. RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
  107. RinUI/config/rin_ui.json +0 -8
  108. RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
  109. RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
  110. RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
  111. RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
  112. RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
  113. rinui-0.0.11.dist-info/RECORD +0 -112
  114. {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/entry_points.txt +0 -0
  115. {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/top_level.txt +0 -0
@@ -1,227 +1,228 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls 2.15
3
- import QtQuick.Layouts 2.15
4
- import "../../themes"
5
- import "../../components"
6
- import "../../windows"
7
-
8
-
9
- RowLayout {
10
- // 外观 / Appearance //
11
- property bool appLayerEnabled: true // 应用层背景
12
- property alias navExpandWidth: navigationBar.expandWidth // 导航栏宽度
13
- property alias navMinimumExpandWidth: navigationBar.minimumExpandWidth // 导航栏保持展开时窗口的最小宽度
14
-
15
- property alias navigationItems: navigationBar.navigationItems // 导航栏item
16
- property string defaultPage: "" // 默认索引项
17
- property var lastPages: [] // 上个页面索引
18
- property int pushEnterFromY: height
19
- property var window: parent // 窗口对象
20
-
21
- signal pageChanged() // 页面切换信号
22
-
23
- id: navigationView
24
- anchors.fill: parent
25
-
26
- Connections {
27
- target: window
28
- function onWidthChanged() {
29
- navigationBar.collapsed = navigationBar.isNotOverMinimumWidth() // 判断窗口是否小于最小宽度
30
- }
31
- }
32
-
33
- NavigationBar {
34
- id: navigationBar
35
- windowTitle: window.title
36
- windowIcon: window.icon
37
- windowWidth: window.width
38
- stackView: stackView
39
- z: 999
40
- Layout.fillHeight: true
41
- }
42
-
43
- // 主体内容区域
44
- Item {
45
- Layout.fillWidth: true
46
- Layout.fillHeight: true
47
-
48
- // 导航栏展开自动收起
49
- MouseArea {
50
- id: collapseCatcher
51
- anchors.fill: parent
52
- z: 1
53
- hoverEnabled: true
54
- acceptedButtons: Qt.AllButtons
55
-
56
- visible: !navigationBar.collapsed && navigationBar.isNotOverMinimumWidth()
57
-
58
- onClicked: {
59
- navigationBar.collapsed = true
60
- }
61
- }
62
-
63
- Rectangle {
64
- id: appLayer
65
- width: parent.width + Utils.windowDragArea + radius
66
- height: parent.height + Utils.windowDragArea + radius
67
- color: Theme.currentTheme.colors.layerColor
68
- border.color: Theme.currentTheme.colors.cardBorderColor
69
- border.width: 1
70
- opacity: window.appLayerEnabled
71
- radius: Theme.currentTheme.appearance.windowRadius
72
- }
73
-
74
-
75
- StackView {
76
- id: stackView
77
- anchors.fill: parent
78
- anchors.leftMargin: 1
79
- anchors.topMargin: 1
80
-
81
-
82
- // 切换动画 / Page Transition //
83
- pushEnter : Transition {
84
- PropertyAnimation {
85
- property: "opacity"
86
- from: 0
87
- to: 1
88
- duration: Utils.animationSpeed
89
- easing.type: Easing.InOutQuad
90
- }
91
-
92
- PropertyAnimation {
93
- property: "y"
94
- from: pushEnterFromY
95
- to: 0
96
- duration: Utils.animationSpeedMiddle
97
- easing.type: Easing.OutQuint
98
- }
99
- }
100
-
101
- pushExit : Transition {
102
- PropertyAnimation {
103
- property: "opacity"
104
- from: 1
105
- to: 0
106
- duration: Utils.animationSpeed
107
- easing.type: Easing.InOutQuad
108
- }
109
- }
110
-
111
- popExit : Transition {
112
- PropertyAnimation {
113
- property: "opacity"
114
- from: 1
115
- to: 0
116
- duration: Utils.animationSpeed
117
- easing.type: Easing.InOutQuad
118
- }
119
-
120
- PropertyAnimation {
121
- property: "y"
122
- from: 0
123
- to: pushEnterFromY
124
- duration: Utils.animationSpeedMiddle
125
- easing.type: Easing.InOutQuint
126
- }
127
- }
128
-
129
- popEnter : Transition {
130
- SequentialAnimation {
131
- PauseAnimation { // 延时 200ms
132
- duration: Utils.animationSpeed
133
- }
134
- PropertyAnimation {
135
- property: "opacity"
136
- from: 0
137
- to: 1
138
- duration: Utils.appearanceSpeed
139
- easing.type: Easing.InOutQuad
140
- }
141
- }
142
- }
143
-
144
- initialItem: Item {}
145
-
146
- }
147
-
148
- // 导航切换逻辑
149
- // Connections {
150
- // target: navigationBar
151
- // function onCurrentIndexChanged() {
152
- // let index = navigationBar.currentIndex
153
- // let page = navigationItems[index].page
154
- // console.log("Pushing Page:", page, "Index:", index)
155
- // if (stackView.depth === 0 || stackView.currentItem.objectName !== page) {
156
- // checkPage(page)
157
- // }
158
- // }
159
- // }
160
-
161
-
162
- Component.onCompleted: {
163
- if (navigationItems.length > 0) {
164
- if (defaultPage !== "") {
165
- safePush(defaultPage, false)
166
- } else {
167
- safePush(navigationItems[0].page, false) // 推送默认页面
168
- } // 推送页面
169
- }
170
- }
171
- }
172
-
173
- function safePop() {
174
- console.log("Popping Page; Depth:", stackView.depth)
175
- if (navigationBar.lastPages.length > 1) {
176
- navigationBar.currentPage = navigationBar.lastPages.pop() // Retrieve and remove the last page
177
- navigationBar.lastPages = navigationBar.lastPages // refresh
178
- stackView.pop()
179
- } else {
180
- console.log("Can't pop: only root page left")
181
- }
182
- }
183
-
184
- function safePush(page, reload) {
185
- // 无效检测
186
- if (!(typeof page === "object" || typeof page === "string" || page instanceof Component)) {
187
- console.error("Invalid page:", page)
188
- return
189
- }
190
-
191
- // 重复检测
192
- if (navigationBar.currentPage === page && !reload) {
193
- console.log("Page already loaded:", page)
194
- return
195
- }
196
-
197
- navigationBar.lastPages.push(navigationBar.currentPage) // 记录当前页面
198
- navigationBar.lastPages = navigationBar.lastPages // refresh
199
- navigationBar.currentPage = page.toString()
200
- pageChanged()
201
-
202
- if (page instanceof Component) {
203
- // let obj = page.createObject(stackView)
204
- stackView.push(page)
205
-
206
- } else if (typeof page === "object" || typeof page === "string" ) {
207
- let component = Qt.createComponent(page) // 页面转控件
208
-
209
- if (component.status === Component.Ready) {
210
- console.log("Depth:", stackView.depth)
211
- stackView.push(component)
212
-
213
- } else if (component.status === Component.Error) {
214
- console.error("Failed to load:", page, component.errorString())
215
- stackView.push("ErrorPage.qml", {
216
- errorMessage: component.errorString(), // 传参
217
- page: page,
218
- })
219
- }
220
- }
221
- }
222
-
223
- function findPageByKey(key) {
224
- const item = menuItems.find(i => i.key === key);
225
- return item ? item.page : null;
226
- }
227
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+ import "../../windows"
7
+
8
+
9
+ RowLayout {
10
+ // 外观 / Appearance //
11
+ property bool appLayerEnabled: true // 应用层背景
12
+ property alias navExpandWidth: navigationBar.expandWidth // 导航栏宽度
13
+ property alias navMinimumExpandWidth: navigationBar.minimumExpandWidth // 导航栏保持展开时窗口的最小宽度
14
+
15
+ property alias navigationItems: navigationBar.navigationItems // 导航栏item
16
+ property alias currentPage: navigationBar.currentPage // 当前页面索引
17
+ property string defaultPage: "" // 默认索引项
18
+ property var lastPages: [] // 上个页面索引
19
+ property int pushEnterFromY: height
20
+ property var window: parent // 窗口对象
21
+
22
+ signal pageChanged() // 页面切换信号
23
+
24
+ id: navigationView
25
+ anchors.fill: parent
26
+
27
+ Connections {
28
+ target: window
29
+ function onWidthChanged() {
30
+ navigationBar.collapsed = navigationBar.isNotOverMinimumWidth() // 判断窗口是否小于最小宽度
31
+ }
32
+ }
33
+
34
+ NavigationBar {
35
+ id: navigationBar
36
+ windowTitle: window.title
37
+ windowIcon: window.icon
38
+ windowWidth: window.width
39
+ stackView: stackView
40
+ z: 999
41
+ Layout.fillHeight: true
42
+ }
43
+
44
+ // 主体内容区域
45
+ Item {
46
+ Layout.fillWidth: true
47
+ Layout.fillHeight: true
48
+
49
+ // 导航栏展开自动收起
50
+ MouseArea {
51
+ id: collapseCatcher
52
+ anchors.fill: parent
53
+ z: 1
54
+ hoverEnabled: true
55
+ acceptedButtons: Qt.AllButtons
56
+
57
+ visible: !navigationBar.collapsed && navigationBar.isNotOverMinimumWidth()
58
+
59
+ onClicked: {
60
+ navigationBar.collapsed = true
61
+ }
62
+ }
63
+
64
+ Rectangle {
65
+ id: appLayer
66
+ width: parent.width + Utils.windowDragArea + radius
67
+ height: parent.height + Utils.windowDragArea + radius
68
+ color: Theme.currentTheme.colors.layerColor
69
+ border.color: Theme.currentTheme.colors.cardBorderColor
70
+ border.width: 1
71
+ opacity: window.appLayerEnabled
72
+ radius: Theme.currentTheme.appearance.windowRadius
73
+ }
74
+
75
+
76
+ StackView {
77
+ id: stackView
78
+ anchors.fill: parent
79
+ anchors.leftMargin: 1
80
+ anchors.topMargin: 1
81
+
82
+
83
+ // 切换动画 / Page Transition //
84
+ pushEnter : Transition {
85
+ PropertyAnimation {
86
+ property: "opacity"
87
+ from: 0
88
+ to: 1
89
+ duration: Utils.animationSpeed
90
+ easing.type: Easing.InOutQuad
91
+ }
92
+
93
+ PropertyAnimation {
94
+ property: "y"
95
+ from: pushEnterFromY
96
+ to: 0
97
+ duration: Utils.animationSpeedMiddle
98
+ easing.type: Easing.OutQuint
99
+ }
100
+ }
101
+
102
+ pushExit : Transition {
103
+ PropertyAnimation {
104
+ property: "opacity"
105
+ from: 1
106
+ to: 0
107
+ duration: Utils.animationSpeed
108
+ easing.type: Easing.InOutQuad
109
+ }
110
+ }
111
+
112
+ popExit : Transition {
113
+ PropertyAnimation {
114
+ property: "opacity"
115
+ from: 1
116
+ to: 0
117
+ duration: Utils.animationSpeed
118
+ easing.type: Easing.InOutQuad
119
+ }
120
+
121
+ PropertyAnimation {
122
+ property: "y"
123
+ from: 0
124
+ to: pushEnterFromY
125
+ duration: Utils.animationSpeedMiddle
126
+ easing.type: Easing.InOutQuint
127
+ }
128
+ }
129
+
130
+ popEnter : Transition {
131
+ SequentialAnimation {
132
+ PauseAnimation { // 延时 200ms
133
+ duration: Utils.animationSpeed
134
+ }
135
+ PropertyAnimation {
136
+ property: "opacity"
137
+ from: 0
138
+ to: 1
139
+ duration: Utils.appearanceSpeed
140
+ easing.type: Easing.InOutQuad
141
+ }
142
+ }
143
+ }
144
+
145
+ initialItem: Item {}
146
+
147
+ }
148
+
149
+ // 导航切换逻辑
150
+ // Connections {
151
+ // target: navigationBar
152
+ // function onCurrentIndexChanged() {
153
+ // let index = navigationBar.currentIndex
154
+ // let page = navigationItems[index].page
155
+ // console.log("Pushing Page:", page, "Index:", index)
156
+ // if (stackView.depth === 0 || stackView.currentItem.objectName !== page) {
157
+ // checkPage(page)
158
+ // }
159
+ // }
160
+ // }
161
+
162
+
163
+ Component.onCompleted: {
164
+ if (navigationItems.length > 0) {
165
+ if (defaultPage !== "") {
166
+ safePush(defaultPage, false)
167
+ } else {
168
+ safePush(navigationItems[0].page, false) // 推送默认页面
169
+ } // 推送页面
170
+ }
171
+ }
172
+ }
173
+
174
+ function safePop() {
175
+ console.log("Popping Page; Depth:", stackView.depth)
176
+ if (navigationBar.lastPages.length > 1) {
177
+ navigationBar.currentPage = navigationBar.lastPages.pop() // Retrieve and remove the last page
178
+ navigationBar.lastPages = navigationBar.lastPages // refresh
179
+ stackView.pop()
180
+ } else {
181
+ console.log("Can't pop: only root page left")
182
+ }
183
+ }
184
+
185
+ function safePush(page, reload) {
186
+ // 无效检测
187
+ if (!(typeof page === "object" || typeof page === "string" || page instanceof Component)) {
188
+ console.error("Invalid page:", page)
189
+ return
190
+ }
191
+
192
+ // 重复检测
193
+ if (navigationBar.currentPage === page && !reload) {
194
+ console.log("Page already loaded:", page)
195
+ return
196
+ }
197
+
198
+ navigationBar.lastPages.push(navigationBar.currentPage) // 记录当前页面
199
+ navigationBar.lastPages = navigationBar.lastPages // refresh
200
+ navigationBar.currentPage = page.toString()
201
+ pageChanged()
202
+
203
+ if (page instanceof Component) {
204
+ // let obj = page.createObject(stackView)
205
+ stackView.push(page)
206
+
207
+ } else if (typeof page === "object" || typeof page === "string" ) {
208
+ let component = Qt.createComponent(page) // 页面转控件
209
+
210
+ if (component.status === Component.Ready) {
211
+ console.log("Depth:", stackView.depth)
212
+ stackView.push(component)
213
+
214
+ } else if (component.status === Component.Error) {
215
+ console.error("Failed to load:", page, component.errorString())
216
+ stackView.push("ErrorPage.qml", {
217
+ errorMessage: component.errorString(), // 传参
218
+ page: page,
219
+ })
220
+ }
221
+ }
222
+ }
223
+
224
+ function findPageByKey(key) {
225
+ const item = menuItems.find(i => i.key === key);
226
+ return item ? item.page : null;
227
+ }
228
+ }
@@ -0,0 +1,17 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../components"
5
+ import "../../themes"
6
+
7
+ TabBar {
8
+ id: root
9
+ implicitWidth: contentWidth
10
+
11
+ background: Rectangle {
12
+ border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
13
+ border.color: Theme.currentTheme.colors.controlBorderColor
14
+ radius: Theme.currentTheme.appearance.buttonRadius
15
+ color: Theme.currentTheme.colors.controlAltSecondaryColor
16
+ }
17
+ }
@@ -0,0 +1,108 @@
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import Qt5Compat.GraphicalEffects
5
+ import "../../components"
6
+ import "../../themes"
7
+
8
+ TabButton {
9
+ id: root
10
+
11
+ implicitWidth: Math.max(row.implicitWidth + 26 , 40)
12
+ implicitHeight: 32
13
+
14
+ background: Rectangle {
15
+ id: background
16
+ anchors.centerIn: parent
17
+ width: checked ? parent.width : parent.width - 4*2
18
+ height: checked ? parent.height : parent.height - 3*2
19
+
20
+ color: checked ? Theme.currentTheme.colors.controlFillColor :
21
+ hovered ? Theme.currentTheme.colors.subtleSecondaryColor : Theme.currentTheme.colors.subtleColor
22
+ radius: Theme.currentTheme.appearance.smallRadius
23
+
24
+ border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
25
+ border.color: checked ? Theme.currentTheme.colors.controlBorderColor : "transparent"
26
+
27
+ Behavior on scale {
28
+ NumberAnimation {
29
+ duration: Utils.animationSpeed
30
+ easing.type: Easing.OutQuart
31
+ }
32
+ }
33
+ }
34
+
35
+ Behavior on opacity {
36
+ NumberAnimation {
37
+ duration: Utils.animationSpeed
38
+ easing.type: Easing.InOutQuint
39
+ }
40
+ }
41
+
42
+ contentItem: Item {
43
+ clip: true
44
+ anchors.fill: parent
45
+
46
+ Row {
47
+ id: row
48
+ spacing: 8
49
+ anchors.centerIn: parent
50
+ IconWidget {
51
+ id: iconWidget
52
+ size: icon || source ? text.font.pixelSize * 1.3 : 0 // 图标大小 / Icon Size
53
+ icon: root.icon.name
54
+ source: root.icon.source
55
+ y: 0.25
56
+ }
57
+
58
+ Text {
59
+ id: text
60
+ typography: Typography.Body
61
+ text: root.text
62
+ color: Theme.currentTheme.colors.textColor
63
+ }
64
+ }
65
+
66
+ Indicator {
67
+ anchors {
68
+ bottom: parent.bottom
69
+ bottomMargin: Theme.currentTheme.appearance.borderWidth
70
+ horizontalCenter: parent.horizontalCenter
71
+ }
72
+ visible: root.checked
73
+ orientation: Qt.Horizontal
74
+ }
75
+ }
76
+
77
+ // 状态变化
78
+ states: [
79
+ State {
80
+ name: "disabled"
81
+ when: !enabled
82
+ PropertyChanges {
83
+ target: root
84
+ opacity: 0.65
85
+ }
86
+ },
87
+ State {
88
+ name: "pressed"
89
+ when: pressed
90
+ PropertyChanges {
91
+ target: root;
92
+ opacity: 0.67
93
+ }
94
+ PropertyChanges {
95
+ target: background;
96
+ scale: 0.95
97
+ }
98
+ },
99
+ State {
100
+ name: "hovered"
101
+ when: hovered
102
+ PropertyChanges {
103
+ target: root;
104
+ opacity: 0.875
105
+ }
106
+ }
107
+ ]
108
+ }
@@ -1,58 +1,13 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls 2.15
3
- import QtQuick.Layouts 2.15
4
- import "../../components"
5
- import "../../themes"
6
-
7
-
8
- RowLayout {
9
- id: root
10
- property var model: []
11
- property int currentIndex: -1
12
- property bool enabled: true
13
- // 自动检测模型类型
14
- readonly property string modelType: {
15
- if (!model) return "null";
16
- if (Array.isArray(model) && typeof model[0] === "object") return "array-with-role";
17
- if (Array.isArray(model)) return "array";
18
- if (model instanceof ListModel) return "listmodel";
19
- if (typeof model === "object" && "count" in model) return "listmodel-like";
20
- return "unknown";
21
- }
22
-
23
- implicitHeight: 40
24
- spacing: 0
25
-
26
- Repeater {
27
- model: root.model
28
- delegate: Button {
29
- Layout.fillWidth: true
30
- Layout.fillHeight: true
31
- Layout.preferredHeight: 40
32
- flat: true
33
-
34
- background: Item {}
35
-
36
- text: {
37
- switch (root.modelType) {
38
- case "array": return modelData;
39
- case "array-with-role": return modelData["text"] || modelData || "";
40
- case "listmodel":
41
- case "listmodel-like":
42
- return model["text"] || modelData || "";
43
- default: return "";
44
- }
45
- }
46
- icon.name: root.modelType === "array-with-role" ? modelData["icon"] : ""
47
- icon.source: root.modelType === "array-with-role" ? modelData["source"] : ""
48
-
49
- onClicked: root.currentIndex = index
50
- enabled: root.enabled
51
-
52
- Indicator {
53
- orientation: Qt.Horizontal
54
- visible: index === root.currentIndex
55
- }
56
- }
57
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../components"
5
+ import "../../themes"
6
+
7
+
8
+ TabBar {
9
+ id: root
10
+ implicitWidth: contentWidth
11
+
12
+ background: Item {}
58
13
  }