RinUI 0.1.0__py3-none-any.whl → 0.1.1.post1__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 +26 -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.post1.data}/data/LICENSE +21 -21
  100. {rinui-0.1.0.data → rinui-0.1.1.post1.data}/data/README.md +100 -100
  101. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/METADATA +116 -115
  102. rinui-0.1.1.post1.dist-info/RECORD +112 -0
  103. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/WHEEL +1 -1
  104. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.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.post1.dist-info}/entry_points.txt +0 -0
  114. {rinui-0.1.0.dist-info → rinui-0.1.1.post1.dist-info}/top_level.txt +0 -0
@@ -1,160 +1,160 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import Qt5Compat.GraphicalEffects
4
- import "../../themes"
5
- import "../../components"
6
-
7
-
8
- ComboBox {
9
- id: root
10
-
11
- // 属性 / Properties
12
- property real controlRadius: Theme.currentTheme.appearance.buttonRadius
13
- property string placeholderText: ""
14
- property alias maxHeight: menu.maxHeight
15
- property string headerText: ""
16
-
17
- implicitWidth: Math.max(contentItem.implicitWidth + 50, 60)
18
- // implicitHeight: contentItem.implicitHeight + 12
19
-
20
- padding: 0
21
-
22
- // accessibility
23
- FocusIndicator {
24
- Indicator {
25
- id: focusIndicator
26
- anchors.left: parent.left
27
- anchors.leftMargin: 2
28
- anchors.verticalCenter: parent.verticalCenter
29
- }
30
- anchors.margins: -1
31
- control: parent
32
- }
33
-
34
-
35
- // 背景 / Background //
36
- background: Rectangle {
37
- id: background
38
- anchors.fill: parent
39
- color: Theme.currentTheme.colors.controlColor
40
- radius: Theme.currentTheme.appearance.buttonRadius
41
-
42
- border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
43
- border.color: Theme.currentTheme.colors.controlBorderColor
44
-
45
- // 裁切
46
- layer.enabled: true
47
- layer.smooth: true
48
- layer.effect: OpacityMask {
49
- maskSource: Rectangle {
50
- width: background.width
51
- height: background.height
52
- radius: background.radius
53
- }
54
- }
55
-
56
- // 底部border
57
- Rectangle {
58
- id: indicator
59
- width: parent.width
60
- anchors.horizontalCenter: parent.horizontalCenter
61
- anchors.bottom: parent.bottom
62
- height: Theme.currentTheme.appearance.borderWidth
63
-
64
- color: Theme.currentTheme.colors.controlBottomBorderColor
65
- }
66
-
67
- Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
68
- opacity: flat && !hovered ? 0 : 1
69
- }
70
-
71
- // 指示器 / Indicator //
72
- indicator: ToolButton {
73
- flat: true
74
- width: 32
75
- height: 24
76
- focusPolicy: editable ? Qt.StrongFocus : Qt.NoFocus
77
- anchors.right: parent.right
78
- anchors.margins: 4
79
- anchors.verticalCenter: parent.verticalCenter
80
- icon.name: "ic_fluent_chevron_down_20_regular"
81
- size: 14
82
- color: Theme.currentTheme.colors.textSecondaryColor
83
- hoverable: editable
84
-
85
- onClicked: menu.open()
86
- }
87
-
88
- // Text //
89
- // contentItem: Text {
90
- // id: text
91
- // typography: Typography.Body
92
- // anchors.left: parent.left
93
- // anchors.leftMargin: 11 // 左边距为 11
94
- // verticalAlignment: Text.AlignVCenter
95
- // height: parent.height
96
- // text: root.displayText ? root.displayText : root.placeholderText
97
- // color: root.displayText ? Theme.currentTheme.colors.textColor : Theme.currentTheme.colors.textSecondaryColor
98
- // }
99
-
100
- contentItem: TextField {
101
- id: text
102
- anchors.fill: parent
103
- text: root.displayText
104
- editable: root.editable
105
- frameless: true
106
- placeholderText: root.placeholderText
107
- }
108
-
109
- // 弹出菜单 / Menu //
110
- popup: ContextMenu {
111
- id: menu
112
- width: root.width
113
- model: root.model
114
- currentIndex: root.currentIndex
115
-
116
- function handleItemSelected(index) {
117
- root.currentIndex = index
118
- return true
119
- }
120
- onItemSelected: handleItemSelected(index)
121
- }
122
-
123
- // 动画
124
- Behavior on opacity { NumberAnimation { duration: 150; easing.type: Easing.OutQuart } }
125
- Behavior on implicitWidth { NumberAnimation { duration: 100; easing.type: Easing.InOutQuart } }
126
-
127
-
128
- // 状态变化
129
- states: [
130
- State {
131
- name: "disabled"
132
- when: !enabled
133
- PropertyChanges { // 禁用时禁止改变属性
134
- target: root;
135
- opacity: 0.4
136
- }
137
- },
138
- State {
139
- name: "pressed"
140
- when: pressed
141
- PropertyChanges {
142
- target: root;
143
- opacity: 0.7
144
- }
145
- PropertyChanges {
146
- target: background;
147
- color: Theme.currentTheme.colors.controlTertiaryColor
148
- }
149
- },
150
- State {
151
- name: "hovered"
152
- when: hovered
153
- PropertyChanges {
154
- target: background;
155
- opacity: 1
156
- color: Theme.currentTheme.colors.controlSecondaryColor
157
- }
158
- }
159
- ]
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import Qt5Compat.GraphicalEffects
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+
8
+ ComboBox {
9
+ id: root
10
+
11
+ // 属性 / Properties
12
+ property real controlRadius: Theme.currentTheme.appearance.buttonRadius
13
+ property string placeholderText: ""
14
+ property alias maxHeight: menu.maxHeight
15
+ property string headerText: ""
16
+
17
+ implicitWidth: Math.max(contentItem.implicitWidth + 50, 60)
18
+ // implicitHeight: contentItem.implicitHeight + 12
19
+
20
+ padding: 0
21
+
22
+ // accessibility
23
+ FocusIndicator {
24
+ Indicator {
25
+ id: focusIndicator
26
+ anchors.left: parent.left
27
+ anchors.leftMargin: 2
28
+ anchors.verticalCenter: parent.verticalCenter
29
+ }
30
+ anchors.margins: -1
31
+ control: parent
32
+ }
33
+
34
+
35
+ // 背景 / Background //
36
+ background: Rectangle {
37
+ id: background
38
+ anchors.fill: parent
39
+ color: Theme.currentTheme.colors.controlColor
40
+ radius: Theme.currentTheme.appearance.buttonRadius
41
+
42
+ border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
43
+ border.color: Theme.currentTheme.colors.controlBorderColor
44
+
45
+ // 裁切
46
+ layer.enabled: true
47
+ layer.smooth: true
48
+ layer.effect: OpacityMask {
49
+ maskSource: Rectangle {
50
+ width: background.width
51
+ height: background.height
52
+ radius: background.radius
53
+ }
54
+ }
55
+
56
+ // 底部border
57
+ Rectangle {
58
+ id: indicator
59
+ width: parent.width
60
+ anchors.horizontalCenter: parent.horizontalCenter
61
+ anchors.bottom: parent.bottom
62
+ height: Theme.currentTheme.appearance.borderWidth
63
+
64
+ color: Theme.currentTheme.colors.controlBottomBorderColor
65
+ }
66
+
67
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
68
+ opacity: flat && !hovered ? 0 : 1
69
+ }
70
+
71
+ // 指示器 / Indicator //
72
+ indicator: ToolButton {
73
+ flat: true
74
+ width: 32
75
+ height: 24
76
+ focusPolicy: editable ? Qt.StrongFocus : Qt.NoFocus
77
+ anchors.right: parent.right
78
+ anchors.margins: 4
79
+ anchors.verticalCenter: parent.verticalCenter
80
+ icon.name: "ic_fluent_chevron_down_20_regular"
81
+ size: 14
82
+ color: Theme.currentTheme.colors.textSecondaryColor
83
+ hoverable: editable
84
+
85
+ onClicked: menu.open()
86
+ }
87
+
88
+ // Text //
89
+ // contentItem: Text {
90
+ // id: text
91
+ // typography: Typography.Body
92
+ // anchors.left: parent.left
93
+ // anchors.leftMargin: 11 // 左边距为 11
94
+ // verticalAlignment: Text.AlignVCenter
95
+ // height: parent.height
96
+ // text: root.displayText ? root.displayText : root.placeholderText
97
+ // color: root.displayText ? Theme.currentTheme.colors.textColor : Theme.currentTheme.colors.textSecondaryColor
98
+ // }
99
+
100
+ contentItem: TextField {
101
+ id: text
102
+ anchors.fill: parent
103
+ text: root.displayText
104
+ editable: root.editable
105
+ frameless: true
106
+ placeholderText: root.placeholderText
107
+ }
108
+
109
+ // 弹出菜单 / Menu //
110
+ popup: ContextMenu {
111
+ id: menu
112
+ width: root.width
113
+ model: root.model
114
+ currentIndex: root.currentIndex
115
+
116
+ function handleItemSelected(index) {
117
+ root.currentIndex = index
118
+ return true
119
+ }
120
+ onItemSelected: handleItemSelected(index)
121
+ }
122
+
123
+ // 动画
124
+ Behavior on opacity { NumberAnimation { duration: 150; easing.type: Easing.OutQuart } }
125
+ Behavior on implicitWidth { NumberAnimation { duration: 100; easing.type: Easing.InOutQuart } }
126
+
127
+
128
+ // 状态变化
129
+ states: [
130
+ State {
131
+ name: "disabled"
132
+ when: !enabled
133
+ PropertyChanges { // 禁用时禁止改变属性
134
+ target: root;
135
+ opacity: 0.4
136
+ }
137
+ },
138
+ State {
139
+ name: "pressed"
140
+ when: pressed
141
+ PropertyChanges {
142
+ target: root;
143
+ opacity: 0.7
144
+ }
145
+ PropertyChanges {
146
+ target: background;
147
+ color: Theme.currentTheme.colors.controlTertiaryColor
148
+ }
149
+ },
150
+ State {
151
+ name: "hovered"
152
+ when: hovered
153
+ PropertyChanges {
154
+ target: background;
155
+ opacity: 1
156
+ color: Theme.currentTheme.colors.controlSecondaryColor
157
+ }
158
+ }
159
+ ]
160
160
  }
@@ -1,21 +1,21 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import QtQuick.Layouts 2.15
4
- import "../../themes"
5
- import "../../components"
6
-
7
- Button {
8
- id: root
9
- default property alias contentData: menu.contentData
10
- suffixIconName: "ic_fluent_chevron_down_20_filled"
11
-
12
- Menu {
13
- id: menu
14
- }
15
-
16
- onClicked: {
17
- if (menu.count > 0) {
18
- menu.open()
19
- }
20
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+ Button {
8
+ id: root
9
+ default property alias contentData: menu.contentData
10
+ suffixIconName: "ic_fluent_chevron_down_20_filled"
11
+
12
+ Menu {
13
+ id: menu
14
+ }
15
+
16
+ onClicked: {
17
+ if (menu.count > 0) {
18
+ menu.open()
19
+ }
20
+ }
21
21
  }
@@ -1,18 +1,18 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls 2.15
3
- import "../../themes"
4
- import "../../components"
5
-
6
-
7
- Button {
8
- id: root
9
- property url openUrl: root.openUrl
10
- property alias url: root.openUrl
11
- flat: true
12
- highlighted: true
13
- // underline: !root.hovered
14
-
15
- onClicked: {
16
- Qt.openUrlExternally(openUrl)
17
- }
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls 2.15
3
+ import "../../themes"
4
+ import "../../components"
5
+
6
+
7
+ Button {
8
+ id: root
9
+ property url openUrl: root.openUrl
10
+ property alias url: root.openUrl
11
+ flat: true
12
+ highlighted: true
13
+ // underline: !root.hovered
14
+
15
+ onClicked: {
16
+ Qt.openUrlExternally(openUrl)
17
+ }
18
18
  }
@@ -1,11 +1,11 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import QtQuick.Layouts 2.15
4
- import "../../themes"
5
- import "../../components"
6
-
7
- RoundButton {
8
- id: root
9
- highlighted: checked
10
- checkable: true
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import QtQuick.Layouts 2.15
4
+ import "../../themes"
5
+ import "../../components"
6
+
7
+ RoundButton {
8
+ id: root
9
+ highlighted: checked
10
+ checkable: true
11
11
  }
@@ -1,95 +1,95 @@
1
- import QtQuick 2.15
2
- import QtQuick.Controls.Basic 2.15
3
- import "../../themes"
4
- import "../../components"
5
-
6
-
7
- RadioButton {
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
-
34
- radius: width / 2
35
- color: checked ? primaryColor :
36
- hovered ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
37
- // 边框 / Border
38
- border.color: checked ? "transparent" : Theme.currentTheme.colors.controlBorderStrongColor
39
- border.width: Theme.currentTheme.appearance.borderWidth
40
-
41
- Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
42
- Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
43
-
44
- // 指示器 / Indicator //
45
- Rectangle {
46
- id: indicator
47
- anchors.centerIn: parent
48
- width: background.width / 2
49
- height: background.height / 2
50
- scale: enabled ?
51
- checked ? pressed ? 0.8 : hovered ? 1.25 : 1 // checked
52
- : pressed ? 1 : 0 // unchecked
53
- : checked ? 1 : 0 // disabled
54
-
55
- anchors.verticalCenter: background.verticalCenter
56
- radius: height / 2
57
- color: checked ? Theme.currentTheme.colors.textOnAccentColor : pressed ? Theme.currentTheme.colors.textOnAccentColor : "transparent"
58
- // color: Theme.currentTheme.colors.textOnAccentColor
59
-
60
- Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
61
- Behavior on scale { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
62
- }
63
- }
64
-
65
- Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
66
-
67
- // 状态变化
68
- states: [
69
- State {
70
- name: "disabled"
71
- when: !enabled
72
- PropertyChanges {
73
- target: root
74
- opacity: 0.4
75
- primaryColor: Theme.currentTheme.colors.disabledColor
76
- }
77
- },
78
- State {
79
- name: "pressed"
80
- when: pressed
81
- PropertyChanges {
82
- target: background;
83
- opacity: 0.65
84
- }
85
- },
86
- State {
87
- name: "hovered"
88
- when: hovered
89
- PropertyChanges {
90
- target: background;
91
- opacity: 0.875
92
- }
93
- }
94
- ]
1
+ import QtQuick 2.15
2
+ import QtQuick.Controls.Basic 2.15
3
+ import "../../themes"
4
+ import "../../components"
5
+
6
+
7
+ RadioButton {
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
+
34
+ radius: width / 2
35
+ color: checked ? primaryColor :
36
+ hovered ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
37
+ // 边框 / Border
38
+ border.color: checked ? "transparent" : Theme.currentTheme.colors.controlBorderStrongColor
39
+ border.width: Theme.currentTheme.appearance.borderWidth
40
+
41
+ Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
42
+ Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
43
+
44
+ // 指示器 / Indicator //
45
+ Rectangle {
46
+ id: indicator
47
+ anchors.centerIn: parent
48
+ width: background.width / 2
49
+ height: background.height / 2
50
+ scale: enabled ?
51
+ checked ? pressed ? 0.8 : hovered ? 1.25 : 1 // checked
52
+ : pressed ? 1 : 0 // unchecked
53
+ : checked ? 1 : 0 // disabled
54
+
55
+ anchors.verticalCenter: background.verticalCenter
56
+ radius: height / 2
57
+ color: checked ? Theme.currentTheme.colors.textOnAccentColor : pressed ? Theme.currentTheme.colors.textOnAccentColor : "transparent"
58
+ // color: Theme.currentTheme.colors.textOnAccentColor
59
+
60
+ Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
61
+ Behavior on scale { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
62
+ }
63
+ }
64
+
65
+ Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
66
+
67
+ // 状态变化
68
+ states: [
69
+ State {
70
+ name: "disabled"
71
+ when: !enabled
72
+ PropertyChanges {
73
+ target: root
74
+ opacity: 0.4
75
+ primaryColor: Theme.currentTheme.colors.disabledColor
76
+ }
77
+ },
78
+ State {
79
+ name: "pressed"
80
+ when: pressed
81
+ PropertyChanges {
82
+ target: background;
83
+ opacity: 0.65
84
+ }
85
+ },
86
+ State {
87
+ name: "hovered"
88
+ when: hovered
89
+ PropertyChanges {
90
+ target: background;
91
+ opacity: 0.875
92
+ }
93
+ }
94
+ ]
95
95
  }
@@ -1,27 +1,27 @@
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 alias radius: background.radius
11
- backgroundColor: highlighted ? primaryColor : Theme.currentTheme.colors.controlQuaternaryColor
12
-
13
- background: Rectangle {
14
- id: background
15
- anchors.fill: parent
16
- color: hovered ? hoverColor : backgroundColor
17
- radius: height / 2
18
-
19
- border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
20
- border.color: flat ? "transparent" :
21
- enabled ? highlighted ? primaryColor : Theme.currentTheme.colors.controlBorderColor :
22
- highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlBorderColor
23
-
24
- Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
25
- opacity: flat && !hovered || !hoverable ? 0 : 1
26
- }
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 alias radius: background.radius
11
+ backgroundColor: highlighted ? primaryColor : Theme.currentTheme.colors.controlQuaternaryColor
12
+
13
+ background: Rectangle {
14
+ id: background
15
+ anchors.fill: parent
16
+ color: hovered ? hoverColor : backgroundColor
17
+ radius: height / 2
18
+
19
+ border.width: Theme.currentTheme.appearance.borderWidth // 边框宽度 / Border Width
20
+ border.color: flat ? "transparent" :
21
+ enabled ? highlighted ? primaryColor : Theme.currentTheme.colors.controlBorderColor :
22
+ highlighted ? Theme.currentTheme.colors.disabledColor : Theme.currentTheme.colors.controlBorderColor
23
+
24
+ Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
25
+ opacity: flat && !hovered || !hoverable ? 0 : 1
26
+ }
27
27
  }