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.
- RinUI/__init__.py +4 -4
- RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
- RinUI/assets/img/default_app_icon.png +0 -0
- RinUI/components/Base.qml +78 -78
- RinUI/components/BasicInput/Button.qml +146 -147
- RinUI/components/BasicInput/CheckBox.qml +98 -98
- RinUI/components/BasicInput/ComboBox.qml +159 -159
- RinUI/components/BasicInput/DropDownButton.qml +20 -20
- RinUI/components/BasicInput/Hyperlink.qml +17 -17
- RinUI/components/BasicInput/PillButton.qml +10 -10
- RinUI/components/BasicInput/RadioButton.qml +94 -94
- RinUI/components/BasicInput/RoundButton.qml +26 -26
- RinUI/components/BasicInput/Slider.qml +212 -212
- RinUI/components/BasicInput/Switch.qml +101 -101
- RinUI/components/BasicInput/ToggleButton.qml +10 -10
- RinUI/components/BasicInput/ToolButton.qml +30 -30
- RinUI/components/ContextMenu.qml +183 -183
- RinUI/components/DateAndTime/DatePicker.qml +142 -140
- RinUI/components/DateAndTime/PickerView.qml +223 -223
- RinUI/components/DateAndTime/TimePicker.qml +114 -114
- RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -106
- RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -47
- RinUI/components/DialogsAndFlyouts/Flyout.qml +87 -144
- RinUI/components/DialogsAndFlyouts/Popup.qml +110 -106
- RinUI/components/FocusIndicator.qml +33 -33
- RinUI/components/IconWidget.qml +52 -52
- RinUI/components/Indicator.qml +89 -89
- RinUI/components/Layout/Expander.qml +159 -159
- RinUI/components/Layout/SettingExpander.qml +66 -66
- RinUI/components/Layout/SettingItem.qml +70 -70
- RinUI/components/ListAndCollections/Clip.qml +21 -21
- RinUI/components/ListAndCollections/Frame.qml +43 -43
- RinUI/components/ListAndCollections/ListView.qml +104 -104
- RinUI/components/ListAndCollections/ListViewDelegate.qml +82 -82
- RinUI/components/ListAndCollections/SettingCard.qml +72 -72
- RinUI/components/ListAndCollections/TableView.qml +81 -81
- RinUI/components/ListAndCollections/TableViewDelegate.qml +88 -88
- RinUI/components/Media/Avatar.qml +83 -0
- RinUI/components/MenusAndToolbars/Menu.qml +150 -150
- RinUI/components/MenusAndToolbars/MenuBar.qml +42 -42
- RinUI/components/MenusAndToolbars/MenuItem.qml +131 -131
- RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -43
- RinUI/components/MenusAndToolbars/MenuSeparator.qml +13 -13
- RinUI/components/MenusAndToolbars/TextInputMenu.qml +37 -37
- RinUI/components/MenusAndToolbars/ToolSeparator.qml +16 -16
- RinUI/components/Navigation/ErrorPage.qml +48 -48
- RinUI/components/Navigation/NavigationBar.qml +179 -179
- RinUI/components/Navigation/NavigationItem.qml +193 -193
- RinUI/components/Navigation/NavigationSubItem.qml +103 -103
- RinUI/components/Navigation/NavigationView.qml +228 -227
- RinUI/components/Navigation/Segmented.qml +17 -0
- RinUI/components/Navigation/SegmentedItem.qml +108 -0
- RinUI/components/Navigation/SelectorBar.qml +12 -57
- RinUI/components/Navigation/SelectorBarItem.qml +89 -0
- RinUI/components/ScrollBar.qml +204 -204
- RinUI/components/ScrollView.qml +12 -12
- RinUI/components/Shadow.qml +47 -47
- RinUI/components/StatusAndInfo/InfoBadge.qml +77 -77
- RinUI/components/StatusAndInfo/InfoBar.qml +256 -251
- RinUI/components/StatusAndInfo/ProgressBar.qml +126 -126
- RinUI/components/StatusAndInfo/ProgressRing.qml +149 -0
- RinUI/components/StatusAndInfo/Toast.qml +236 -236
- RinUI/components/StatusAndInfo/ToolTip.qml +93 -93
- RinUI/components/Text/SpinBox.qml +150 -133
- RinUI/components/Text/Text.qml +44 -44
- RinUI/components/Text/TextArea.qml +117 -117
- RinUI/components/Text/TextField.qml +113 -113
- RinUI/components/Text/TextInput.qml +47 -47
- RinUI/components/qmldir +80 -77
- RinUI/core/__init__.py +4 -4
- RinUI/core/config.py +129 -129
- RinUI/core/launcher.py +129 -129
- RinUI/core/theme.py +339 -339
- RinUI/core/translator.py +25 -25
- RinUI/hooks/__init__.py +3 -3
- RinUI/hooks/hook-RinUI.py +3 -3
- RinUI/qmldir +108 -97
- RinUI/themes/Appearance.qml +36 -0
- RinUI/themes/Colors.qml +36 -0
- RinUI/themes/dark.qml +145 -136
- RinUI/themes/light.qml +145 -136
- RinUI/themes/qmldir +9 -6
- RinUI/themes/theme.qml +151 -149
- RinUI/themes/utils.qml +37 -37
- RinUI/utils/Animation.qml +12 -12
- RinUI/utils/FloatLayer.qml +132 -123
- RinUI/utils/FontIconLoader.qml +13 -13
- RinUI/utils/Position.qml +19 -19
- RinUI/utils/Severity.qml +13 -13
- RinUI/utils/Typography.qml +17 -17
- RinUI/utils/qmldir +4 -4
- RinUI/windows/CtrlBtn.qml +118 -118
- RinUI/windows/FluentPage.qml +92 -92
- RinUI/windows/FluentWindow.qml +31 -30
- RinUI/windows/FluentWindowBase.qml +158 -158
- RinUI/windows/TitleBar.qml +135 -135
- RinUI/windows/qmldir +7 -7
- RinUI/windows/window/ApplicationWindow.qml +8 -8
- RinUI/windows/window/Window.qml +118 -118
- {rinui-0.0.11.data → rinui-0.1.1.data}/data/LICENSE +21 -21
- {rinui-0.0.11.data → rinui-0.1.1.data}/data/README.md +100 -97
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/METADATA +116 -112
- rinui-0.1.1.dist-info/RECORD +112 -0
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/WHEEL +1 -1
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info/licenses}/LICENSE +21 -21
- RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/config/rin_ui.json +0 -8
- RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/translator.cpython-38.pyc +0 -0
- rinui-0.0.11.dist-info/RECORD +0 -112
- {rinui-0.0.11.dist-info → rinui-0.1.1.dist-info}/entry_points.txt +0 -0
- {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.
|
86
|
-
icon: root.icon.name
|
87
|
-
source: root.icon.source
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
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
|
}
|