RinUI 0.0.9__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 (102) hide show
  1. RinUI/__init__.py +4 -0
  2. RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
  3. RinUI/assets/fonts/FluentSystemIcons-Index.js +5256 -0
  4. RinUI/assets/fonts/FluentSystemIcons-Resizable.ttf +0 -0
  5. RinUI/assets/img/default_app_icon.png +0 -0
  6. RinUI/components/Base.qml +79 -0
  7. RinUI/components/BasicInput/Button.qml +148 -0
  8. RinUI/components/BasicInput/CheckBox.qml +99 -0
  9. RinUI/components/BasicInput/ComboBox.qml +160 -0
  10. RinUI/components/BasicInput/DropDownButton.qml +21 -0
  11. RinUI/components/BasicInput/Hyperlink.qml +18 -0
  12. RinUI/components/BasicInput/RadioButton.qml +95 -0
  13. RinUI/components/BasicInput/Slider.qml +212 -0
  14. RinUI/components/BasicInput/Switch.qml +102 -0
  15. RinUI/components/BasicInput/ToggleButton.qml +11 -0
  16. RinUI/components/BasicInput/ToolButton.qml +31 -0
  17. RinUI/components/ContextMenu.qml +184 -0
  18. RinUI/components/DateAndTime/PickerView.qml +217 -0
  19. RinUI/components/DateAndTime/TimePicker.qml +115 -0
  20. RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -0
  21. RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -0
  22. RinUI/components/DialogsAndFlyouts/Flyout.qml +144 -0
  23. RinUI/components/DialogsAndFlyouts/Popup.qml +106 -0
  24. RinUI/components/FocusIndicator.qml +33 -0
  25. RinUI/components/IconWidget.qml +52 -0
  26. RinUI/components/Indicator.qml +90 -0
  27. RinUI/components/Layout/Expander.qml +160 -0
  28. RinUI/components/Layout/SettingExpander.qml +67 -0
  29. RinUI/components/Layout/SettingItem.qml +71 -0
  30. RinUI/components/ListAndCollections/Clip.qml +22 -0
  31. RinUI/components/ListAndCollections/Frame.qml +44 -0
  32. RinUI/components/ListAndCollections/ListView.qml +105 -0
  33. RinUI/components/ListAndCollections/ListViewDelegate.qml +83 -0
  34. RinUI/components/ListAndCollections/SettingCard.qml +73 -0
  35. RinUI/components/ListAndCollections/TableView.qml +82 -0
  36. RinUI/components/ListAndCollections/TableViewDelegate.qml +89 -0
  37. RinUI/components/MenusAndToolbars/Menu.qml +149 -0
  38. RinUI/components/MenusAndToolbars/MenuBar.qml +43 -0
  39. RinUI/components/MenusAndToolbars/MenuItem.qml +119 -0
  40. RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -0
  41. RinUI/components/MenusAndToolbars/MenuSeparator.qml +14 -0
  42. RinUI/components/MenusAndToolbars/ToolSeparator.qml +17 -0
  43. RinUI/components/Navigation/ErrorPage.qml +48 -0
  44. RinUI/components/Navigation/NavigationBar.qml +179 -0
  45. RinUI/components/Navigation/NavigationItem.qml +193 -0
  46. RinUI/components/Navigation/NavigationSubItem.qml +103 -0
  47. RinUI/components/Navigation/NavigationView.qml +210 -0
  48. RinUI/components/Navigation/SelectorBar.qml +58 -0
  49. RinUI/components/ScrollBar.qml +163 -0
  50. RinUI/components/ScrollView.qml +13 -0
  51. RinUI/components/Shadow.qml +48 -0
  52. RinUI/components/StatusAndInfo/InfoBadge.qml +78 -0
  53. RinUI/components/StatusAndInfo/InfoBar.qml +246 -0
  54. RinUI/components/StatusAndInfo/ProgressBar.qml +127 -0
  55. RinUI/components/StatusAndInfo/Toast.qml +237 -0
  56. RinUI/components/StatusAndInfo/ToolTip.qml +93 -0
  57. RinUI/components/Text/SpinBox.qml +134 -0
  58. RinUI/components/Text/Text.qml +44 -0
  59. RinUI/components/Text/TextField.qml +94 -0
  60. RinUI/components/Text/TextInput.qml +29 -0
  61. RinUI/components/Utils/Blur.qml +42 -0
  62. RinUI/components/qmldir +76 -0
  63. RinUI/config/rin_ui.json +8 -0
  64. RinUI/core/__init__.py +3 -0
  65. RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
  66. RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
  67. RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
  68. RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
  69. RinUI/core/config.py +109 -0
  70. RinUI/core/launcher.py +144 -0
  71. RinUI/core/theme.py +342 -0
  72. RinUI/hooks/__init__.py +3 -0
  73. RinUI/hooks/hook-RinUI.py +3 -0
  74. RinUI/qmldir +92 -0
  75. RinUI/themes/dark.qml +137 -0
  76. RinUI/themes/light.qml +137 -0
  77. RinUI/themes/qmldir +7 -0
  78. RinUI/themes/theme.qml +126 -0
  79. RinUI/themes/utils.qml +28 -0
  80. RinUI/utils/Animation.qml +12 -0
  81. RinUI/utils/FloatLayer.qml +123 -0
  82. RinUI/utils/FontIconLoader.qml +14 -0
  83. RinUI/utils/Position.qml +19 -0
  84. RinUI/utils/Severity.qml +13 -0
  85. RinUI/utils/Typography.qml +17 -0
  86. RinUI/utils/qmldir +5 -0
  87. RinUI/windows/CtrlBtn.qml +119 -0
  88. RinUI/windows/FluentPage.qml +92 -0
  89. RinUI/windows/FluentWindow.qml +32 -0
  90. RinUI/windows/FluentWindowBase.qml +157 -0
  91. RinUI/windows/TitleBar.qml +132 -0
  92. RinUI/windows/qmldir +8 -0
  93. RinUI/windows/window/ApplicationWindow.qml +9 -0
  94. RinUI/windows/window/Window.qml +112 -0
  95. rinui-0.0.9.data/data/LICENSE +21 -0
  96. rinui-0.0.9.data/data/README.md +90 -0
  97. rinui-0.0.9.dist-info/LICENSE +21 -0
  98. rinui-0.0.9.dist-info/METADATA +105 -0
  99. rinui-0.0.9.dist-info/RECORD +102 -0
  100. rinui-0.0.9.dist-info/WHEEL +5 -0
  101. rinui-0.0.9.dist-info/entry_points.txt +2 -0
  102. rinui-0.0.9.dist-info/top_level.txt +1 -0
Binary file
@@ -0,0 +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()
79
+ }
@@ -0,0 +1,148 @@
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
+ ]
148
+ }
@@ -0,0 +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
+ ]
99
+ }
@@ -0,0 +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
+ ]
160
+ }
@@ -0,0 +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
+ }
21
+ }
@@ -0,0 +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
+ }
18
+ }
@@ -0,0 +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
+ ]
95
+ }