RinUI 0.1.0__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 (114) hide show
  1. RinUI/__init__.py +4 -4
  2. RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
  3. RinUI/components/Base.qml +78 -78
  4. RinUI/components/BasicInput/Button.qml +146 -146
  5. RinUI/components/BasicInput/CheckBox.qml +98 -98
  6. RinUI/components/BasicInput/ComboBox.qml +159 -159
  7. RinUI/components/BasicInput/DropDownButton.qml +20 -20
  8. RinUI/components/BasicInput/Hyperlink.qml +17 -17
  9. RinUI/components/BasicInput/PillButton.qml +10 -10
  10. RinUI/components/BasicInput/RadioButton.qml +94 -94
  11. RinUI/components/BasicInput/RoundButton.qml +26 -26
  12. RinUI/components/BasicInput/Slider.qml +212 -212
  13. RinUI/components/BasicInput/Switch.qml +101 -101
  14. RinUI/components/BasicInput/ToggleButton.qml +10 -10
  15. RinUI/components/BasicInput/ToolButton.qml +30 -30
  16. RinUI/components/ContextMenu.qml +183 -183
  17. RinUI/components/DateAndTime/DatePicker.qml +142 -140
  18. RinUI/components/DateAndTime/PickerView.qml +223 -223
  19. RinUI/components/DateAndTime/TimePicker.qml +114 -114
  20. RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
  21. RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
  22. RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -87
  23. RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
  24. RinUI/components/FocusIndicator.qml +33 -33
  25. RinUI/components/IconWidget.qml +52 -52
  26. RinUI/components/Indicator.qml +89 -89
  27. RinUI/components/Layout/Expander.qml +159 -159
  28. RinUI/components/Layout/SettingExpander.qml +66 -66
  29. RinUI/components/Layout/SettingItem.qml +70 -70
  30. RinUI/components/ListAndCollections/Clip.qml +21 -21
  31. RinUI/components/ListAndCollections/Frame.qml +43 -43
  32. RinUI/components/ListAndCollections/ListView.qml +104 -104
  33. RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
  34. RinUI/components/ListAndCollections/SettingCard.qml +72 -72
  35. RinUI/components/ListAndCollections/TableView.qml +81 -81
  36. RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
  37. RinUI/components/Media/Avatar.qml +82 -82
  38. RinUI/components/MenusAndToolbars/Menu.qml +150 -150
  39. RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
  40. RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
  41. RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
  42. RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
  43. RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
  44. RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
  45. RinUI/components/Navigation/ErrorPage.qml +48 -48
  46. RinUI/components/Navigation/NavigationBar.qml +179 -179
  47. RinUI/components/Navigation/NavigationItem.qml +193 -193
  48. RinUI/components/Navigation/NavigationSubItem.qml +103 -103
  49. RinUI/components/Navigation/NavigationView.qml +228 -227
  50. RinUI/components/Navigation/Segmented.qml +16 -16
  51. RinUI/components/Navigation/SegmentedItem.qml +107 -107
  52. RinUI/components/Navigation/SelectorBar.qml +12 -12
  53. RinUI/components/Navigation/SelectorBarItem.qml +88 -88
  54. RinUI/components/ScrollBar.qml +204 -204
  55. RinUI/components/ScrollView.qml +12 -12
  56. RinUI/components/Shadow.qml +47 -47
  57. RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
  58. RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
  59. RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
  60. RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
  61. RinUI/components/StatusAndInfo/Toast.qml +236 -236
  62. RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
  63. RinUI/components/Text/SpinBox.qml +150 -133
  64. RinUI/components/Text/Text.qml +44 -44
  65. RinUI/components/Text/TextArea.qml +117 -117
  66. RinUI/components/Text/TextField.qml +113 -113
  67. RinUI/components/Text/TextInput.qml +47 -47
  68. RinUI/components/qmldir +80 -80
  69. RinUI/core/__init__.py +4 -4
  70. RinUI/core/config.py +129 -129
  71. RinUI/core/launcher.py +129 -129
  72. RinUI/core/theme.py +339 -339
  73. RinUI/core/translator.py +25 -25
  74. RinUI/hooks/__init__.py +3 -3
  75. RinUI/hooks/hook-RinUI.py +3 -3
  76. RinUI/qmldir +108 -104
  77. RinUI/themes/Appearance.qml +36 -0
  78. RinUI/themes/Colors.qml +36 -0
  79. RinUI/themes/dark.qml +145 -145
  80. RinUI/themes/light.qml +145 -145
  81. RinUI/themes/qmldir +9 -6
  82. RinUI/themes/theme.qml +151 -149
  83. RinUI/themes/utils.qml +37 -37
  84. RinUI/utils/Animation.qml +12 -12
  85. RinUI/utils/FloatLayer.qml +132 -123
  86. RinUI/utils/FontIconLoader.qml +13 -13
  87. RinUI/utils/Position.qml +19 -19
  88. RinUI/utils/Severity.qml +13 -13
  89. RinUI/utils/Typography.qml +17 -17
  90. RinUI/utils/qmldir +4 -4
  91. RinUI/windows/CtrlBtn.qml +118 -118
  92. RinUI/windows/FluentPage.qml +92 -92
  93. RinUI/windows/FluentWindow.qml +31 -30
  94. RinUI/windows/FluentWindowBase.qml +158 -158
  95. RinUI/windows/TitleBar.qml +135 -135
  96. RinUI/windows/qmldir +7 -7
  97. RinUI/windows/window/ApplicationWindow.qml +8 -8
  98. RinUI/windows/window/Window.qml +118 -118
  99. {rinui-0.1.0.data → rinui-0.1.1.data}/data/LICENSE +21 -21
  100. {rinui-0.1.0.data → rinui-0.1.1.data}/data/README.md +100 -100
  101. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/METADATA +116 -115
  102. rinui-0.1.1.dist-info/RECORD +112 -0
  103. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/WHEEL +1 -1
  104. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info/licenses}/LICENSE +21 -21
  105. RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
  106. RinUI/config/rin_ui.json +0 -8
  107. RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
  108. RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
  109. RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
  110. RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
  111. RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
  112. rinui-0.1.0.dist-info/RECORD +0 -116
  113. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/entry_points.txt +0 -0
  114. {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/top_level.txt +0 -0
RinUI/components/Base.qml CHANGED
@@ -1,79 +1,79 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls 2.15
3
- import "../themes"
4
-
5
- Item {
6
- id: root
7
- implicitWidth: 100
8
- implicitHeight: 40
9
-
10
- // 公共属性 / Common Properties
11
- property color backgroundColor: Theme.currentTheme.colors.controlColor
12
- property color borderColor: Theme.currentTheme.colors.controlBorderColor
13
- property color textColor: Theme.currentTheme.colors.textColor
14
-
15
- property real borderTransparency: Theme.currentTheme.appearance.borderFactor
16
- property real controlRadius: Theme.currentTheme.appearance.buttonRadius
17
-
18
- property bool hovered: false // 悬停
19
- property bool pressed: false // 按下
20
- property bool enabled: true // 是否启用
21
-
22
- // 启用 MouseArea / Enable MouseArea
23
- property bool interactive: true
24
-
25
- // Update
26
- // 禁用状态
27
- onEnabledChanged: updateStyle()
28
-
29
- // 主题切换 / Theme Switching
30
- Connections {
31
- target: Theme
32
- function onCurrentThemeChanged() {
33
- updateStyle()
34
- }
35
- }
36
-
37
- Component.onCompleted: updateStyle()
38
-
39
- function updateStyle() {
40
- backgroundColor = Theme.currentTheme.colors.controlColor
41
- borderColor = Theme.currentTheme.colors.controlBorderColor
42
- textColor = Theme.currentTheme.colors.textColor
43
- controlRadius = Theme.currentTheme.appearance.buttonRadius
44
- // borderTransparency = Theme.currentTheme.appearance.borderTransparency
45
- }
46
-
47
- // 颜色动画 / Color Animation
48
- Behavior on backgroundColor { ColorAnimation { duration: 200; easing.type: Easing.OutQuart } }
49
- Behavior on textColor { ColorAnimation { duration: 200; easing.type: Easing.OutQuart } }
50
- Behavior on borderColor { ColorAnimation { duration: 200; easing.type: Easing.OutQuart } }
51
-
52
- // 交互 / Interaction
53
- MouseArea {
54
- id: mouseArea
55
- visible: interactive
56
- anchors.fill: parent
57
- hoverEnabled: true
58
-
59
- // hover状态 / Hover State
60
- onEntered: root.hovered = true
61
- onExited: root.hovered = false
62
-
63
- // 按下状态 / Pressed State
64
- onPressed: root.pressed = true
65
- onReleased: root.pressed = false
66
-
67
- onClicked: {
68
- if (!root.enabled) {
69
- mouse.accepted = true // 忽略鼠标点击事件
70
- return
71
- }
72
- root.clicked()
73
- }
74
- }
75
-
76
-
77
-
78
- signal clicked()
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import "../themes"
4
+
5
+ Item {
6
+ id: root
7
+ implicitWidth: 100
8
+ implicitHeight: 40
9
+
10
+ // 公共属性 / Common Properties
11
+ property color backgroundColor: Theme.currentTheme.colors.controlColor
12
+ property color borderColor: Theme.currentTheme.colors.controlBorderColor
13
+ property color textColor: Theme.currentTheme.colors.textColor
14
+
15
+ property real borderTransparency: Theme.currentTheme.appearance.borderFactor
16
+ property real controlRadius: Theme.currentTheme.appearance.buttonRadius
17
+
18
+ property bool hovered: false // 悬停
19
+ property bool pressed: false // 按下
20
+ property bool enabled: true // 是否启用
21
+
22
+ // 启用 MouseArea / Enable MouseArea
23
+ property bool interactive: true
24
+
25
+ // Update
26
+ // 禁用状态
27
+ onEnabledChanged: updateStyle()
28
+
29
+ // 主题切换 / Theme Switching
30
+ Connections {
31
+ target: Theme
32
+ function onCurrentThemeChanged() {
33
+ updateStyle()
34
+ }
35
+ }
36
+
37
+ Component.onCompleted: updateStyle()
38
+
39
+ function updateStyle() {
40
+ backgroundColor = Theme.currentTheme.colors.controlColor
41
+ borderColor = Theme.currentTheme.colors.controlBorderColor
42
+ textColor = Theme.currentTheme.colors.textColor
43
+ controlRadius = Theme.currentTheme.appearance.buttonRadius
44
+ // borderTransparency = Theme.currentTheme.appearance.borderTransparency
45
+ }
46
+
47
+ // 颜色动画 / Color Animation
48
+ Behavior on backgroundColor { ColorAnimation { duration: 200; easing.type: Easing.OutQuart } }
49
+ Behavior on textColor { ColorAnimation { duration: 200; easing.type: Easing.OutQuart } }
50
+ Behavior on borderColor { ColorAnimation { duration: 200; easing.type: Easing.OutQuart } }
51
+
52
+ // 交互 / Interaction
53
+ MouseArea {
54
+ id: mouseArea
55
+ visible: interactive
56
+ anchors.fill: parent
57
+ hoverEnabled: true
58
+
59
+ // hover状态 / Hover State
60
+ onEntered: root.hovered = true
61
+ onExited: root.hovered = false
62
+
63
+ // 按下状态 / Pressed State
64
+ onPressed: root.pressed = true
65
+ onReleased: root.pressed = false
66
+
67
+ onClicked: {
68
+ if (!root.enabled) {
69
+ mouse.accepted = true // 忽略鼠标点击事件
70
+ return
71
+ }
72
+ root.clicked()
73
+ }
74
+ }
75
+
76
+
77
+
78
+ signal clicked()
79
79
  }
@@ -1,147 +1,147 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import QtQuick.Layouts 2.15
4
- import Qt5Compat.GraphicalEffects
5
- import "../../themes"
6
- import "../../components"
7
-
8
- Button {
9
- id: root
10
- property color primaryColor: Theme.currentTheme.colors.primaryColor
11
- property color backgroundColor: flat ? Theme.currentTheme.colors.subtleSecondaryColor :
12
- highlighted ? primaryColor : Theme.currentTheme.colors.controlColor
13
- // default property alias icon.source: icon.source
14
- property alias size: text.font.pixelSize
15
- property bool hoverable: true // 是否可悬停
16
- property bool accessibliityIndicator: true // 是否显示辅助提示
17
- property string suffixIconName: "" // 后缀图标
18
-
19
- readonly property color hoverColor: !highlighted && !flat
20
- ? Theme.currentTheme.colors.controlSecondaryColor : backgroundColor
21
-
22
- // accessibility
23
- FocusIndicator {
24
- control: parent
25
- opacity: accessibliityIndicator
26
- }
27
-
28
- padding: 6
29
- topPadding: 5
30
- bottomPadding: 7
31
-
32
- background: Rectangle {
33
- id: background
34
- anchors.fill: parent
35
- color: hovered ? hoverColor : backgroundColor
36
- radius: Theme.currentTheme.appearance.buttonRadius
37
-
38
- border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
39
- border.color: flat ? "transparent" :
40
- enabled ? highlighted ? primaryColor : Theme.currentTheme.colors.controlBorderColor :
41
- highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlBorderColor
42
-
43
- // 裁切
44
- layer.enabled: true
45
- layer.smooth: true
46
- layer.effect: OpacityMask {
47
- maskSource: Rectangle {
48
- width: background.width
49
- height: background.height
50
- radius: background.radius
51
- }
52
- }
53
-
54
- // 底部border
55
- Rectangle {
56
- id: indicator
57
- width: parent.width
58
- anchors.horizontalCenter: parent.horizontalCenter
59
- anchors.bottom: parent.bottom
60
- height: Theme.currentTheme.appearance.borderWidth
61
-
62
- color: flat ? "transparent" :
63
- enabled ? highlighted ? Theme.currentTheme.colors.controlAccentBottomBorderColor
64
- : Theme.currentTheme.colors.controlBottomBorderColor
65
- : "transparent"
66
- }
67
-
68
- Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
69
- opacity: flat && !hovered || !hoverable ? 0 : 1
70
- }
71
-
72
- implicitWidth: Math.max(row.implicitWidth + 26, 40)
73
- implicitHeight: Math.max(text.height + 12, 32)
74
-
75
- contentItem: Item {
76
- clip: true
77
- anchors.fill: parent
78
-
79
- Row {
80
- id: row
81
- spacing: 8
82
- anchors.centerIn: parent
83
- IconWidget {
84
- id: iconWidget
85
- size: icon || source ? text.font.pixelSize * 1.3 : 0 // 图标大小 / Icon Size
86
- icon: root.icon.name
87
- source: root.icon.source
88
- y: 0.25
89
- color: icon.color ? icon.color : highlighted ? flat ?
90
- enabled ? Theme.currentTheme.colors.textAccentColor : Theme.currentTheme.colors.textColor :
91
- Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
92
- }
93
- Text {
94
- id: text
95
- typography: Typography.Body
96
- text: root.text
97
- color: highlighted ? flat ? Theme.currentTheme.colors.textAccentColor :
98
- Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
99
- }
100
- // 后缀图标
101
- IconWidget {
102
- id: suffixIcon
103
- size: 12
104
- height: parent.height
105
- icon: root.suffixIconName
106
- color: Theme.currentTheme.colors.textSecondaryColor
107
- visible: root.suffixIconName !== ""
108
- }
109
- }
110
- }
111
-
112
- Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
113
-
114
- // 状态变化
115
- states: [
116
- State {
117
- name: "disabled"
118
- when: !enabled
119
- PropertyChanges {
120
- target: root
121
- opacity: 0.65
122
- backgroundColor: highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlColor
123
- }
124
- PropertyChanges {
125
- target: text
126
- color: flat ? Theme.currentTheme.colors.disabledColor : text.color
127
- }
128
- },
129
- State {
130
- name: "pressed"
131
- when: pressed
132
- PropertyChanges {
133
- target: root;
134
- opacity: !highlighted && !flat ? 0.7 : 0.65
135
- backgroundColor: !highlighted && !flat ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
136
- }
137
- },
138
- State {
139
- name: "hovered"
140
- when: hovered && hoverable
141
- PropertyChanges {
142
- target: root;
143
- opacity: !highlighted && !flat ? 1 : 0.875
144
- }
145
- }
146
- ]
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import Qt5Compat.GraphicalEffects
5
+ import "../../themes"
6
+ import "../../components"
7
+
8
+ Button {
9
+ id: root
10
+ property color primaryColor: Theme.currentTheme.colors.primaryColor
11
+ property color backgroundColor: flat ? Theme.currentTheme.colors.subtleSecondaryColor :
12
+ highlighted ? primaryColor : Theme.currentTheme.colors.controlColor
13
+ // default property alias icon.source: icon.source
14
+ property alias size: text.font.pixelSize
15
+ property bool hoverable: true // 是否可悬停
16
+ property bool accessibliityIndicator: true // 是否显示辅助提示
17
+ property string suffixIconName: "" // 后缀图标
18
+
19
+ readonly property color hoverColor: !highlighted && !flat
20
+ ? Theme.currentTheme.colors.controlSecondaryColor : backgroundColor
21
+
22
+ // accessibility
23
+ FocusIndicator {
24
+ control: parent
25
+ opacity: accessibliityIndicator
26
+ }
27
+
28
+ padding: 6
29
+ topPadding: 5
30
+ bottomPadding: 7
31
+
32
+ background: Rectangle {
33
+ id: background
34
+ anchors.fill: parent
35
+ color: hovered ? hoverColor : backgroundColor
36
+ radius: Theme.currentTheme.appearance.buttonRadius
37
+
38
+ border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
39
+ border.color: flat ? "transparent" :
40
+ enabled ? highlighted ? primaryColor : Theme.currentTheme.colors.controlBorderColor :
41
+ highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlBorderColor
42
+
43
+ // 裁切
44
+ layer.enabled: true
45
+ layer.smooth: true
46
+ layer.effect: OpacityMask {
47
+ maskSource: Rectangle {
48
+ width: background.width
49
+ height: background.height
50
+ radius: background.radius
51
+ }
52
+ }
53
+
54
+ // 底部border
55
+ Rectangle {
56
+ id: indicator
57
+ width: parent.width
58
+ anchors.horizontalCenter: parent.horizontalCenter
59
+ anchors.bottom: parent.bottom
60
+ height: Theme.currentTheme.appearance.borderWidth
61
+
62
+ color: flat ? "transparent" :
63
+ enabled ? highlighted ? Theme.currentTheme.colors.controlAccentBottomBorderColor
64
+ : Theme.currentTheme.colors.controlBottomBorderColor
65
+ : "transparent"
66
+ }
67
+
68
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
69
+ opacity: flat && !hovered || !hoverable ? 0 : 1
70
+ }
71
+
72
+ implicitWidth: Math.max(row.implicitWidth + 26, 40)
73
+ implicitHeight: Math.max(text.height + 12, 32)
74
+
75
+ contentItem: Item {
76
+ clip: true
77
+ anchors.fill: parent
78
+
79
+ Row {
80
+ id: row
81
+ spacing: 8
82
+ anchors.centerIn: parent
83
+ IconWidget {
84
+ id: iconWidget
85
+ size: icon || source ? text.font.pixelSize * 1.3 : 0 // 图标大小 / Icon Size
86
+ icon: root.icon.name
87
+ source: root.icon.source
88
+ y: 0.25
89
+ color: icon.color ? icon.color : highlighted ? flat ?
90
+ enabled ? Theme.currentTheme.colors.textAccentColor : Theme.currentTheme.colors.textColor :
91
+ Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
92
+ }
93
+ Text {
94
+ id: text
95
+ typography: Typography.Body
96
+ text: root.text
97
+ color: highlighted ? flat ? Theme.currentTheme.colors.textAccentColor :
98
+ Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
99
+ }
100
+ // 后缀图标
101
+ IconWidget {
102
+ id: suffixIcon
103
+ size: 12
104
+ height: parent.height
105
+ icon: root.suffixIconName
106
+ color: Theme.currentTheme.colors.textSecondaryColor
107
+ visible: root.suffixIconName !== ""
108
+ }
109
+ }
110
+ }
111
+
112
+ Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
113
+
114
+ // 状态变化
115
+ states: [
116
+ State {
117
+ name: "disabled"
118
+ when: !enabled
119
+ PropertyChanges {
120
+ target: root
121
+ opacity: 0.65
122
+ backgroundColor: highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlColor
123
+ }
124
+ PropertyChanges {
125
+ target: text
126
+ color: flat ? Theme.currentTheme.colors.disabledColor : text.color
127
+ }
128
+ },
129
+ State {
130
+ name: "pressed"
131
+ when: pressed
132
+ PropertyChanges {
133
+ target: root;
134
+ opacity: !highlighted && !flat ? 0.7 : 0.65
135
+ backgroundColor: !highlighted && !flat ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
136
+ }
137
+ },
138
+ State {
139
+ name: "hovered"
140
+ when: hovered && hoverable
141
+ PropertyChanges {
142
+ target: root;
143
+ opacity: !highlighted && !flat ? 1 : 0.875
144
+ }
145
+ }
146
+ ]
147
147
  }
@@ -1,99 +1,99 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import "../../themes"
4
- import "../../components"
5
-
6
-
7
- CheckBox {
8
- id: root
9
- property color backgroundColor: Theme.currentTheme.colors.controlSecondaryColor
10
- property color primaryColor: Theme.currentTheme.colors.primaryColor
11
-
12
- spacing: 8
13
-
14
- // accessibility
15
- FocusIndicator {
16
- control: parent
17
- }
18
-
19
- contentItem: Text {
20
- leftPadding: root.indicator.width + root.spacing
21
- verticalAlignment: Text.AlignVCenter
22
-
23
- text: root.text
24
- }
25
-
26
- // 指示器 / indicator //
27
- indicator: Rectangle {
28
- id: background
29
- width: 20
30
- height: 20
31
- x: root.leftPadding
32
- y: parent.height / 2 - height / 2
33
- radius: Theme.currentTheme.appearance.buttonRadius
34
- color: checkState !== Qt.Unchecked ? primaryColor :
35
- hovered ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
36
- // 边框 / Border
37
- border.color: checkState !== Qt.Unchecked ? "transparent" : Theme.currentTheme.colors.controlBorderStrongColor
38
- border.width: Theme.currentTheme.appearance.borderWidth
39
-
40
- Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
41
- Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
42
-
43
- // 指示器 / Indicator //
44
- Rectangle {
45
- id: mask
46
- anchors.verticalCenter: background.verticalCenter
47
- anchors.left: background.left
48
- anchors.leftMargin: 4
49
- width: checkState !== Qt.Unchecked ? 12 : 0
50
- height: 12
51
- clip: true
52
- color: "transparent"
53
-
54
- Behavior on width { NumberAnimation { duration: Utils.animationSpeedMiddle; easing.type: Easing.OutQuint } }
55
-
56
- IconWidget {
57
- id: indicator
58
- icon: checkState !== Qt.PartiallyChecked
59
- ? "ic_fluent_checkmark_20_filled" :
60
- "ic_fluent_subtract_20_regular"
61
- size: 12
62
- color: Theme.currentTheme.colors.textOnAccentColor
63
-
64
- Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
65
- }
66
- }
67
- }
68
-
69
- Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
70
-
71
- // 状态变化
72
- states: [
73
- State {
74
- name: "disabled"
75
- when: !enabled
76
- PropertyChanges {
77
- target: root
78
- opacity: 0.4
79
- primaryColor: Theme.currentTheme.colors.disabledColor
80
- }
81
- },
82
- State {
83
- name: "pressed"
84
- when: pressed
85
- PropertyChanges {
86
- target: background;
87
- opacity: 0.65
88
- }
89
- },
90
- State {
91
- name: "hovered"
92
- when: hovered
93
- PropertyChanges {
94
- target: background;
95
- opacity: 0.875
96
- }
97
- }
98
- ]
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import "../../themes"
4
+ import "../../components"
5
+
6
+
7
+ CheckBox {
8
+ id: root
9
+ property color backgroundColor: Theme.currentTheme.colors.controlSecondaryColor
10
+ property color primaryColor: Theme.currentTheme.colors.primaryColor
11
+
12
+ spacing: 8
13
+
14
+ // accessibility
15
+ FocusIndicator {
16
+ control: parent
17
+ }
18
+
19
+ contentItem: Text {
20
+ leftPadding: root.indicator.width + root.spacing
21
+ verticalAlignment: Text.AlignVCenter
22
+
23
+ text: root.text
24
+ }
25
+
26
+ // 指示器 / indicator //
27
+ indicator: Rectangle {
28
+ id: background
29
+ width: 20
30
+ height: 20
31
+ x: root.leftPadding
32
+ y: parent.height / 2 - height / 2
33
+ radius: Theme.currentTheme.appearance.buttonRadius
34
+ color: checkState !== Qt.Unchecked ? primaryColor :
35
+ hovered ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
36
+ // 边框 / Border
37
+ border.color: checkState !== Qt.Unchecked ? "transparent" : Theme.currentTheme.colors.controlBorderStrongColor
38
+ border.width: Theme.currentTheme.appearance.borderWidth
39
+
40
+ Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
41
+ Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
42
+
43
+ // 指示器 / Indicator //
44
+ Rectangle {
45
+ id: mask
46
+ anchors.verticalCenter: background.verticalCenter
47
+ anchors.left: background.left
48
+ anchors.leftMargin: 4
49
+ width: checkState !== Qt.Unchecked ? 12 : 0
50
+ height: 12
51
+ clip: true
52
+ color: "transparent"
53
+
54
+ Behavior on width { NumberAnimation { duration: Utils.animationSpeedMiddle; easing.type: Easing.OutQuint } }
55
+
56
+ IconWidget {
57
+ id: indicator
58
+ icon: checkState !== Qt.PartiallyChecked
59
+ ? "ic_fluent_checkmark_20_filled" :
60
+ "ic_fluent_subtract_20_regular"
61
+ size: 12
62
+ color: Theme.currentTheme.colors.textOnAccentColor
63
+
64
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
65
+ }
66
+ }
67
+ }
68
+
69
+ Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
70
+
71
+ // 状态变化
72
+ states: [
73
+ State {
74
+ name: "disabled"
75
+ when: !enabled
76
+ PropertyChanges {
77
+ target: root
78
+ opacity: 0.4
79
+ primaryColor: Theme.currentTheme.colors.disabledColor
80
+ }
81
+ },
82
+ State {
83
+ name: "pressed"
84
+ when: pressed
85
+ PropertyChanges {
86
+ target: background;
87
+ opacity: 0.65
88
+ }
89
+ },
90
+ State {
91
+ name: "hovered"
92
+ when: hovered
93
+ PropertyChanges {
94
+ target: background;
95
+ opacity: 0.875
96
+ }
97
+ }
98
+ ]
99
99
  }