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,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
- states: [
109
- State {
110
- name: "disabled"
111
- when: !enabled
112
- PropertyChanges { // 禁用时禁止改变属性
113
- target: root;
114
- opacity: !editable ? 1 : 0.4
115
- }
116
- },
117
- State {
118
- name: "pressed&focused"
119
- when: activeFocus
120
- PropertyChanges {
121
- target: background;
122
- color: Theme.currentTheme.colors.controlInputActiveColor
123
- }
124
- },
125
- State {
126
- name: "hovered"
127
- when: hovered
128
- PropertyChanges {
129
- target: background;
130
- color: Theme.currentTheme.colors.controlSecondaryColor
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
  }
@@ -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
  }