RinUI 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- RinUI/__init__.py +4 -4
- RinUI/assets/fonts/FluentSystemIcons-Index.js +5255 -5255
- RinUI/components/Base.qml +78 -78
- RinUI/components/BasicInput/Button.qml +146 -146
- 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 -87
- 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 +82 -82
- 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 +16 -16
- RinUI/components/Navigation/SegmentedItem.qml +107 -107
- RinUI/components/Navigation/SelectorBar.qml +12 -12
- RinUI/components/Navigation/SelectorBarItem.qml +88 -88
- 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 -80
- 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 -104
- RinUI/themes/Appearance.qml +36 -0
- RinUI/themes/Colors.qml +36 -0
- RinUI/themes/dark.qml +145 -145
- RinUI/themes/light.qml +145 -145
- 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.1.0.data → rinui-0.1.1.data}/data/LICENSE +21 -21
- {rinui-0.1.0.data → rinui-0.1.1.data}/data/README.md +100 -100
- {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/METADATA +116 -115
- rinui-0.1.1.dist-info/RECORD +112 -0
- {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/WHEEL +1 -1
- {rinui-0.1.0.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.1.0.dist-info/RECORD +0 -116
- {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/entry_points.txt +0 -0
- {rinui-0.1.0.dist-info → rinui-0.1.1.dist-info}/top_level.txt +0 -0
@@ -1,134 +1,151 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import Qt5Compat.GraphicalEffects
|
3
|
-
import QtQuick.Controls.Basic 2.15
|
4
|
-
import "../../themes"
|
5
|
-
import "../../components"
|
6
|
-
|
7
|
-
|
8
|
-
SpinBox {
|
9
|
-
id: root
|
10
|
-
editable: true
|
11
|
-
|
12
|
-
property color primaryColor: Theme.currentTheme.colors.primaryColor
|
13
|
-
|
14
|
-
contentItem: TextInput {
|
15
|
-
selectByMouse: true
|
16
|
-
text: root.textFromValue(root.value, root.locale)
|
17
|
-
horizontalAlignment: Qt.AlignLeft
|
18
|
-
verticalAlignment: Qt.AlignVCenter
|
19
|
-
|
20
|
-
readOnly: !root.editable
|
21
|
-
validator: root.validator
|
22
|
-
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
23
|
-
}
|
24
|
-
|
25
|
-
implicitWidth: Math.max(implicitWidth + upBtn.width + downBtn.width + 8, 124)
|
26
|
-
|
27
|
-
// 背景 / Background //
|
28
|
-
background: Rectangle {
|
29
|
-
id: background
|
30
|
-
anchors.fill: parent
|
31
|
-
radius: Theme.currentTheme.appearance.buttonRadius
|
32
|
-
color: Theme.currentTheme.colors.controlColor
|
33
|
-
clip: true
|
34
|
-
border.width: Theme.currentTheme.appearance.borderWidth
|
35
|
-
border.color: Theme.currentTheme.colors.controlBorderColor
|
36
|
-
|
37
|
-
layer.enabled: true
|
38
|
-
layer.smooth: true
|
39
|
-
layer.effect: OpacityMask {
|
40
|
-
maskSource: Rectangle {
|
41
|
-
width: background.width
|
42
|
-
height: background.height
|
43
|
-
radius: background.radius
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
// 底部指示器 / indicator //
|
48
|
-
Rectangle {
|
49
|
-
id: indicator
|
50
|
-
width: parent.width
|
51
|
-
anchors.horizontalCenter: parent.horizontalCenter
|
52
|
-
anchors.bottom: parent.bottom
|
53
|
-
radius: 999
|
54
|
-
height: root.activeFocus ? Theme.currentTheme.appearance.borderWidth * 2 : Theme.currentTheme.appearance.borderWidth
|
55
|
-
color: root.activeFocus ? primaryColor : Theme.currentTheme.colors.textControlBorderColor
|
56
|
-
|
57
|
-
Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
58
|
-
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
up.indicator: ToolButton {
|
63
|
-
id: upBtn
|
64
|
-
flat: true
|
65
|
-
z: 9
|
66
|
-
focusPolicy: editable ? Qt.StrongFocus : Qt.NoFocus
|
67
|
-
implicitWidth: 32
|
68
|
-
implicitHeight: 24
|
69
|
-
anchors.top: parent.top
|
70
|
-
anchors.right: downBtn.left
|
71
|
-
anchors.bottom: parent.bottom
|
72
|
-
anchors.margins: 4
|
73
|
-
anchors.bottomMargin: 6
|
74
|
-
icon.name: "ic_fluent_chevron_up_20_regular"
|
75
|
-
size: 16
|
76
|
-
color: Theme.currentTheme.colors.textSecondaryColor
|
77
|
-
hoverable: editable
|
78
|
-
onClicked: increase()
|
79
|
-
}
|
80
|
-
|
81
|
-
down.indicator: ToolButton {
|
82
|
-
id: downBtn
|
83
|
-
z: 9
|
84
|
-
flat: true
|
85
|
-
focusPolicy: editable ? Qt.StrongFocus : Qt.NoFocus
|
86
|
-
implicitWidth: 32
|
87
|
-
implicitHeight: 24
|
88
|
-
anchors.top: parent.top
|
89
|
-
anchors.right: parent.right
|
90
|
-
anchors.bottom: parent.bottom
|
91
|
-
anchors.margins: 4
|
92
|
-
anchors.bottomMargin: 6
|
93
|
-
icon.name: "ic_fluent_chevron_down_20_regular"
|
94
|
-
size: 16
|
95
|
-
color: Theme.currentTheme.colors.textSecondaryColor
|
96
|
-
hoverable: editable
|
97
|
-
onClicked: decrease()
|
98
|
-
}
|
99
|
-
|
100
|
-
leftPadding: 12
|
101
|
-
rightPadding: 12
|
102
|
-
topPadding: 5
|
103
|
-
bottomPadding: 7
|
104
|
-
|
105
|
-
Behavior on opacity { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
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
|
-
|
1
|
+
import QtQuick 2.15
|
2
|
+
import Qt5Compat.GraphicalEffects
|
3
|
+
import QtQuick.Controls.Basic 2.15
|
4
|
+
import "../../themes"
|
5
|
+
import "../../components"
|
6
|
+
|
7
|
+
|
8
|
+
SpinBox {
|
9
|
+
id: root
|
10
|
+
editable: true
|
11
|
+
|
12
|
+
property color primaryColor: Theme.currentTheme.colors.primaryColor
|
13
|
+
|
14
|
+
contentItem: TextInput {
|
15
|
+
selectByMouse: true
|
16
|
+
text: root.textFromValue(root.value, root.locale)
|
17
|
+
horizontalAlignment: Qt.AlignLeft
|
18
|
+
verticalAlignment: Qt.AlignVCenter
|
19
|
+
|
20
|
+
readOnly: !root.editable
|
21
|
+
validator: root.validator
|
22
|
+
inputMethodHints: Qt.ImhFormattedNumbersOnly
|
23
|
+
}
|
24
|
+
|
25
|
+
implicitWidth: Math.max(implicitWidth + upBtn.width + downBtn.width + 8, 124)
|
26
|
+
|
27
|
+
// 背景 / Background //
|
28
|
+
background: Rectangle {
|
29
|
+
id: background
|
30
|
+
anchors.fill: parent
|
31
|
+
radius: Theme.currentTheme.appearance.buttonRadius
|
32
|
+
color: Theme.currentTheme.colors.controlColor
|
33
|
+
clip: true
|
34
|
+
border.width: Theme.currentTheme.appearance.borderWidth
|
35
|
+
border.color: Theme.currentTheme.colors.controlBorderColor
|
36
|
+
|
37
|
+
layer.enabled: true
|
38
|
+
layer.smooth: true
|
39
|
+
layer.effect: OpacityMask {
|
40
|
+
maskSource: Rectangle {
|
41
|
+
width: background.width
|
42
|
+
height: background.height
|
43
|
+
radius: background.radius
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
// 底部指示器 / indicator //
|
48
|
+
Rectangle {
|
49
|
+
id: indicator
|
50
|
+
width: parent.width
|
51
|
+
anchors.horizontalCenter: parent.horizontalCenter
|
52
|
+
anchors.bottom: parent.bottom
|
53
|
+
radius: 999
|
54
|
+
height: root.activeFocus ? Theme.currentTheme.appearance.borderWidth * 2 : Theme.currentTheme.appearance.borderWidth
|
55
|
+
color: root.activeFocus ? primaryColor : Theme.currentTheme.colors.textControlBorderColor
|
56
|
+
|
57
|
+
Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
58
|
+
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
up.indicator: ToolButton {
|
63
|
+
id: upBtn
|
64
|
+
flat: true
|
65
|
+
z: 9
|
66
|
+
focusPolicy: editable ? Qt.StrongFocus : Qt.NoFocus
|
67
|
+
implicitWidth: 32
|
68
|
+
implicitHeight: 24
|
69
|
+
anchors.top: parent.top
|
70
|
+
anchors.right: downBtn.left
|
71
|
+
anchors.bottom: parent.bottom
|
72
|
+
anchors.margins: 4
|
73
|
+
anchors.bottomMargin: 6
|
74
|
+
icon.name: "ic_fluent_chevron_up_20_regular"
|
75
|
+
size: 16
|
76
|
+
color: Theme.currentTheme.colors.textSecondaryColor
|
77
|
+
hoverable: editable
|
78
|
+
onClicked: increase()
|
79
|
+
}
|
80
|
+
|
81
|
+
down.indicator: ToolButton {
|
82
|
+
id: downBtn
|
83
|
+
z: 9
|
84
|
+
flat: true
|
85
|
+
focusPolicy: editable ? Qt.StrongFocus : Qt.NoFocus
|
86
|
+
implicitWidth: 32
|
87
|
+
implicitHeight: 24
|
88
|
+
anchors.top: parent.top
|
89
|
+
anchors.right: parent.right
|
90
|
+
anchors.bottom: parent.bottom
|
91
|
+
anchors.margins: 4
|
92
|
+
anchors.bottomMargin: 6
|
93
|
+
icon.name: "ic_fluent_chevron_down_20_regular"
|
94
|
+
size: 16
|
95
|
+
color: Theme.currentTheme.colors.textSecondaryColor
|
96
|
+
hoverable: editable
|
97
|
+
onClicked: decrease()
|
98
|
+
}
|
99
|
+
|
100
|
+
leftPadding: 12
|
101
|
+
rightPadding: 12
|
102
|
+
topPadding: 5
|
103
|
+
bottomPadding: 7
|
104
|
+
|
105
|
+
Behavior on opacity { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
106
|
+
|
107
|
+
// 恢复滚轮调整数值
|
108
|
+
WheelHandler {
|
109
|
+
id: wheelHandler
|
110
|
+
target: spin
|
111
|
+
onWheel: (event) => {
|
112
|
+
if (!root.focus) {
|
113
|
+
return; // 如果没有焦点,则不处理滚轮事件
|
114
|
+
}
|
115
|
+
if (event.angleDelta.y > 0) {
|
116
|
+
root.value += root.stepSize;
|
117
|
+
} else if (event.angleDelta.y < 0) {
|
118
|
+
root.value -= root.stepSize;
|
119
|
+
}
|
120
|
+
event.accepted = true; // 阻止事件继续冒泡
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
// 状态变化
|
125
|
+
states: [
|
126
|
+
State {
|
127
|
+
name: "disabled"
|
128
|
+
when: !enabled
|
129
|
+
PropertyChanges { // 禁用时禁止改变属性
|
130
|
+
target: root;
|
131
|
+
opacity: !editable ? 1 : 0.4
|
132
|
+
}
|
133
|
+
},
|
134
|
+
State {
|
135
|
+
name: "pressed&focused"
|
136
|
+
when: activeFocus
|
137
|
+
PropertyChanges {
|
138
|
+
target: background;
|
139
|
+
color: Theme.currentTheme.colors.controlInputActiveColor
|
140
|
+
}
|
141
|
+
},
|
142
|
+
State {
|
143
|
+
name: "hovered"
|
144
|
+
when: hovered
|
145
|
+
PropertyChanges {
|
146
|
+
target: background;
|
147
|
+
color: Theme.currentTheme.colors.controlSecondaryColor
|
148
|
+
}
|
149
|
+
}
|
150
|
+
]
|
134
151
|
}
|
RinUI/components/Text/Text.qml
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
import QtQuick
|
2
|
-
import QtQuick.Controls
|
3
|
-
import "../../themes"
|
4
|
-
import "../../utils"
|
5
|
-
|
6
|
-
Text {
|
7
|
-
id: label
|
8
|
-
property int typography: Typography.Body
|
9
|
-
|
10
|
-
color: targetColor
|
11
|
-
property color targetColor: Theme.currentTheme.colors.textColor // 目标颜色,用于切换动画
|
12
|
-
wrapMode: Text.WordWrap
|
13
|
-
|
14
|
-
// 主题切换动画 TODO: 会坠机
|
15
|
-
// Behavior on color {
|
16
|
-
// ColorAnimation {
|
17
|
-
// duration: Utils.appearanceSpeed
|
18
|
-
// easing.type: Easing.OutQuart
|
19
|
-
// }
|
20
|
-
// }
|
21
|
-
|
22
|
-
font.pixelSize: {
|
23
|
-
switch (typography) {
|
24
|
-
case Typography.Display: return Theme.currentTheme.typography.displaySize;
|
25
|
-
case Typography.TitleLarge: return Theme.currentTheme.typography.titleLargeSize;
|
26
|
-
case Typography.Title: return Theme.currentTheme.typography.titleSize;
|
27
|
-
case Typography.Subtitle: return Theme.currentTheme.typography.subtitleSize;
|
28
|
-
case Typography.Body: return Theme.currentTheme.typography.bodySize;
|
29
|
-
case Typography.BodyStrong: return Theme.currentTheme.typography.bodyStrongSize;
|
30
|
-
case Typography.BodyLarge: return Theme.currentTheme.typography.bodyLargeSize;
|
31
|
-
case Typography.Caption: return Theme.currentTheme.typography.captionSize;
|
32
|
-
default: return Theme.currentTheme.typography.bodySize;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
font.family: Utils.fontFamily
|
37
|
-
|
38
|
-
font.bold: typography === Typography.Display ||
|
39
|
-
typography === Typography.TitleLarge ||
|
40
|
-
typography === Typography.Title ||
|
41
|
-
typography === Typography.Subtitle ||
|
42
|
-
typography === Typography.BodyLarge ||
|
43
|
-
typography === Typography.BodyStrong
|
44
|
-
}
|
1
|
+
import QtQuick
|
2
|
+
import QtQuick.Controls
|
3
|
+
import "../../themes"
|
4
|
+
import "../../utils"
|
5
|
+
|
6
|
+
Text {
|
7
|
+
id: label
|
8
|
+
property int typography: Typography.Body
|
9
|
+
|
10
|
+
color: targetColor
|
11
|
+
property color targetColor: Theme.currentTheme.colors.textColor // 目标颜色,用于切换动画
|
12
|
+
wrapMode: Text.WordWrap
|
13
|
+
|
14
|
+
// 主题切换动画 TODO: 会坠机
|
15
|
+
// Behavior on color {
|
16
|
+
// ColorAnimation {
|
17
|
+
// duration: Utils.appearanceSpeed
|
18
|
+
// easing.type: Easing.OutQuart
|
19
|
+
// }
|
20
|
+
// }
|
21
|
+
|
22
|
+
font.pixelSize: {
|
23
|
+
switch (typography) {
|
24
|
+
case Typography.Display: return Theme.currentTheme.typography.displaySize;
|
25
|
+
case Typography.TitleLarge: return Theme.currentTheme.typography.titleLargeSize;
|
26
|
+
case Typography.Title: return Theme.currentTheme.typography.titleSize;
|
27
|
+
case Typography.Subtitle: return Theme.currentTheme.typography.subtitleSize;
|
28
|
+
case Typography.Body: return Theme.currentTheme.typography.bodySize;
|
29
|
+
case Typography.BodyStrong: return Theme.currentTheme.typography.bodyStrongSize;
|
30
|
+
case Typography.BodyLarge: return Theme.currentTheme.typography.bodyLargeSize;
|
31
|
+
case Typography.Caption: return Theme.currentTheme.typography.captionSize;
|
32
|
+
default: return Theme.currentTheme.typography.bodySize;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
font.family: Utils.fontFamily
|
37
|
+
|
38
|
+
font.bold: typography === Typography.Display ||
|
39
|
+
typography === Typography.TitleLarge ||
|
40
|
+
typography === Typography.Title ||
|
41
|
+
typography === Typography.Subtitle ||
|
42
|
+
typography === Typography.BodyLarge ||
|
43
|
+
typography === Typography.BodyStrong
|
44
|
+
}
|
@@ -1,118 +1,118 @@
|
|
1
|
-
import QtQuick 2.15
|
2
|
-
import Qt5Compat.GraphicalEffects
|
3
|
-
import QtQuick.Controls.Basic 2.15
|
4
|
-
import "../../themes"
|
5
|
-
import "../../components"
|
6
|
-
|
7
|
-
TextArea {
|
8
|
-
id: root
|
9
|
-
|
10
|
-
property bool frameless: false
|
11
|
-
property bool editable: true
|
12
|
-
property color primaryColor: Theme.currentTheme.colors.primaryColor
|
13
|
-
|
14
|
-
selectByMouse: true
|
15
|
-
enabled: editable
|
16
|
-
|
17
|
-
// Menu
|
18
|
-
TextInputMenu {
|
19
|
-
id: contextMenu
|
20
|
-
}
|
21
|
-
|
22
|
-
MouseArea {
|
23
|
-
anchors.fill: parent
|
24
|
-
acceptedButtons: Qt.RightButton
|
25
|
-
propagateComposedEvents: true
|
26
|
-
onPressed: (mouse) => {
|
27
|
-
if (mouse.button === Qt.RightButton)
|
28
|
-
contextMenu.popup(mouse.scenePosition)
|
29
|
-
mouse.accepted = false
|
30
|
-
}
|
31
|
-
|
32
|
-
// 鼠标
|
33
|
-
cursorShape: Qt.IBeamCursor
|
34
|
-
}
|
35
|
-
|
36
|
-
// 背景 / Background //
|
37
|
-
background: Rectangle {
|
38
|
-
id: background
|
39
|
-
anchors.fill: parent
|
40
|
-
radius: Theme.currentTheme.appearance.buttonRadius
|
41
|
-
color: frameless ? "transparent" : Theme.currentTheme.colors.controlColor
|
42
|
-
clip: true
|
43
|
-
border.width: Theme.currentTheme.appearance.borderWidth
|
44
|
-
border.color: frameless ? root.activeFocus ? Theme.currentTheme.colors.controlBorderColor : "transparent" :
|
45
|
-
Theme.currentTheme.colors.controlBorderColor
|
46
|
-
|
47
|
-
layer.enabled: true
|
48
|
-
layer.smooth: true
|
49
|
-
layer.effect: OpacityMask {
|
50
|
-
maskSource: Rectangle {
|
51
|
-
width: background.width
|
52
|
-
height: background.height
|
53
|
-
radius: background.radius
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
// 底部指示器 / indicator //
|
58
|
-
Rectangle {
|
59
|
-
id: indicator
|
60
|
-
width: parent.width
|
61
|
-
anchors.horizontalCenter: parent.horizontalCenter
|
62
|
-
anchors.bottom: parent.bottom
|
63
|
-
radius: 999
|
64
|
-
height: root.activeFocus ? Theme.currentTheme.appearance.borderWidth * 2 : Theme.currentTheme.appearance.borderWidth
|
65
|
-
color: root.activeFocus ? primaryColor : frameless ? "transparent" : Theme.currentTheme.colors.textControlBorderColor
|
66
|
-
|
67
|
-
Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
68
|
-
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
Behavior on opacity { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
73
|
-
|
74
|
-
|
75
|
-
// 字体 / Font //
|
76
|
-
font.pixelSize: Theme.currentTheme.typography.bodySize
|
77
|
-
|
78
|
-
wrapMode: Text.WordWrap // 自动换行
|
79
|
-
selectionColor: Theme.currentTheme.colors.primaryColor
|
80
|
-
color: Theme.currentTheme.colors.textColor
|
81
|
-
placeholderTextColor: Theme.currentTheme.colors.textSecondaryColor
|
82
|
-
|
83
|
-
leftPadding: 12
|
84
|
-
rightPadding: 12
|
85
|
-
topPadding: 5
|
86
|
-
bottomPadding: 7
|
87
|
-
|
88
|
-
// 动画 / Animation //
|
89
|
-
Behavior on implicitHeight { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
90
|
-
|
91
|
-
// 状态
|
92
|
-
states: [
|
93
|
-
State {
|
94
|
-
name: "disabled"
|
95
|
-
when: !enabled
|
96
|
-
PropertyChanges { // 禁用时禁止改变属性
|
97
|
-
target: root;
|
98
|
-
opacity: !editable ? 1 : 0.4
|
99
|
-
}
|
100
|
-
},
|
101
|
-
State {
|
102
|
-
name: "pressed&focused"
|
103
|
-
when: activeFocus
|
104
|
-
PropertyChanges {
|
105
|
-
target: background;
|
106
|
-
color: Theme.currentTheme.colors.controlInputActiveColor
|
107
|
-
}
|
108
|
-
},
|
109
|
-
State {
|
110
|
-
name: "hovered"
|
111
|
-
when: hovered
|
112
|
-
PropertyChanges {
|
113
|
-
target: background;
|
114
|
-
color: Theme.currentTheme.colors.controlSecondaryColor
|
115
|
-
}
|
116
|
-
}
|
117
|
-
]
|
1
|
+
import QtQuick 2.15
|
2
|
+
import Qt5Compat.GraphicalEffects
|
3
|
+
import QtQuick.Controls.Basic 2.15
|
4
|
+
import "../../themes"
|
5
|
+
import "../../components"
|
6
|
+
|
7
|
+
TextArea {
|
8
|
+
id: root
|
9
|
+
|
10
|
+
property bool frameless: false
|
11
|
+
property bool editable: true
|
12
|
+
property color primaryColor: Theme.currentTheme.colors.primaryColor
|
13
|
+
|
14
|
+
selectByMouse: true
|
15
|
+
enabled: editable
|
16
|
+
|
17
|
+
// Menu
|
18
|
+
TextInputMenu {
|
19
|
+
id: contextMenu
|
20
|
+
}
|
21
|
+
|
22
|
+
MouseArea {
|
23
|
+
anchors.fill: parent
|
24
|
+
acceptedButtons: Qt.RightButton
|
25
|
+
propagateComposedEvents: true
|
26
|
+
onPressed: (mouse) => {
|
27
|
+
if (mouse.button === Qt.RightButton)
|
28
|
+
contextMenu.popup(mouse.scenePosition)
|
29
|
+
mouse.accepted = false
|
30
|
+
}
|
31
|
+
|
32
|
+
// 鼠标
|
33
|
+
cursorShape: Qt.IBeamCursor
|
34
|
+
}
|
35
|
+
|
36
|
+
// 背景 / Background //
|
37
|
+
background: Rectangle {
|
38
|
+
id: background
|
39
|
+
anchors.fill: parent
|
40
|
+
radius: Theme.currentTheme.appearance.buttonRadius
|
41
|
+
color: frameless ? "transparent" : Theme.currentTheme.colors.controlColor
|
42
|
+
clip: true
|
43
|
+
border.width: Theme.currentTheme.appearance.borderWidth
|
44
|
+
border.color: frameless ? root.activeFocus ? Theme.currentTheme.colors.controlBorderColor : "transparent" :
|
45
|
+
Theme.currentTheme.colors.controlBorderColor
|
46
|
+
|
47
|
+
layer.enabled: true
|
48
|
+
layer.smooth: true
|
49
|
+
layer.effect: OpacityMask {
|
50
|
+
maskSource: Rectangle {
|
51
|
+
width: background.width
|
52
|
+
height: background.height
|
53
|
+
radius: background.radius
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
// 底部指示器 / indicator //
|
58
|
+
Rectangle {
|
59
|
+
id: indicator
|
60
|
+
width: parent.width
|
61
|
+
anchors.horizontalCenter: parent.horizontalCenter
|
62
|
+
anchors.bottom: parent.bottom
|
63
|
+
radius: 999
|
64
|
+
height: root.activeFocus ? Theme.currentTheme.appearance.borderWidth * 2 : Theme.currentTheme.appearance.borderWidth
|
65
|
+
color: root.activeFocus ? primaryColor : frameless ? "transparent" : Theme.currentTheme.colors.textControlBorderColor
|
66
|
+
|
67
|
+
Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
68
|
+
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
Behavior on opacity { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
73
|
+
|
74
|
+
|
75
|
+
// 字体 / Font //
|
76
|
+
font.pixelSize: Theme.currentTheme.typography.bodySize
|
77
|
+
|
78
|
+
wrapMode: Text.WordWrap // 自动换行
|
79
|
+
selectionColor: Theme.currentTheme.colors.primaryColor
|
80
|
+
color: Theme.currentTheme.colors.textColor
|
81
|
+
placeholderTextColor: Theme.currentTheme.colors.textSecondaryColor
|
82
|
+
|
83
|
+
leftPadding: 12
|
84
|
+
rightPadding: 12
|
85
|
+
topPadding: 5
|
86
|
+
bottomPadding: 7
|
87
|
+
|
88
|
+
// 动画 / Animation //
|
89
|
+
Behavior on implicitHeight { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
90
|
+
|
91
|
+
// 状态
|
92
|
+
states: [
|
93
|
+
State {
|
94
|
+
name: "disabled"
|
95
|
+
when: !enabled
|
96
|
+
PropertyChanges { // 禁用时禁止改变属性
|
97
|
+
target: root;
|
98
|
+
opacity: !editable ? 1 : 0.4
|
99
|
+
}
|
100
|
+
},
|
101
|
+
State {
|
102
|
+
name: "pressed&focused"
|
103
|
+
when: activeFocus
|
104
|
+
PropertyChanges {
|
105
|
+
target: background;
|
106
|
+
color: Theme.currentTheme.colors.controlInputActiveColor
|
107
|
+
}
|
108
|
+
},
|
109
|
+
State {
|
110
|
+
name: "hovered"
|
111
|
+
when: hovered
|
112
|
+
PropertyChanges {
|
113
|
+
target: background;
|
114
|
+
color: Theme.currentTheme.colors.controlSecondaryColor
|
115
|
+
}
|
116
|
+
}
|
117
|
+
]
|
118
118
|
}
|