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
Binary file
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,148 +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.25 : 0 // 图标大小 / Icon Size
86
- icon: root.icon.name
87
- source: root.icon.source
88
- height: parent.height
89
- y: 0.25
90
- color: icon.color ? icon.color : highlighted ? flat ?
91
- enabled ? Theme.currentTheme.colors.textAccentColor : Theme.currentTheme.colors.textColor :
92
- Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
93
- }
94
- Text {
95
- id: text
96
- typography: Typography.Body
97
- text: root.text
98
- color: highlighted ? flat ? Theme.currentTheme.colors.textAccentColor :
99
- Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
100
- }
101
- // 后缀图标
102
- IconWidget {
103
- id: suffixIcon
104
- size: 12
105
- height: parent.height
106
- icon: root.suffixIconName
107
- color: Theme.currentTheme.colors.textSecondaryColor
108
- visible: root.suffixIconName !== ""
109
- }
110
- }
111
- }
112
-
113
- Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
114
-
115
- // 状态变化
116
- states: [
117
- State {
118
- name: "disabled"
119
- when: !enabled
120
- PropertyChanges {
121
- target: root
122
- opacity: 0.65
123
- backgroundColor: highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlColor
124
- }
125
- PropertyChanges {
126
- target: text
127
- color: flat ? Theme.currentTheme.colors.disabledColor : text.color
128
- }
129
- },
130
- State {
131
- name: "pressed"
132
- when: pressed
133
- PropertyChanges {
134
- target: root;
135
- opacity: !highlighted && !flat ? 0.7 : 0.65
136
- backgroundColor: !highlighted && !flat ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
137
- }
138
- },
139
- State {
140
- name: "hovered"
141
- when: hovered && hoverable
142
- PropertyChanges {
143
- target: root;
144
- opacity: !highlighted && !flat ? 1 : 0.875
145
- }
146
- }
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
+ ]
148
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
  }