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.
- RinUI/__init__.py +4 -0
- RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/assets/fonts/FluentSystemIcons-Index.js +5256 -0
- RinUI/assets/fonts/FluentSystemIcons-Resizable.ttf +0 -0
- RinUI/assets/img/default_app_icon.png +0 -0
- RinUI/components/Base.qml +79 -0
- RinUI/components/BasicInput/Button.qml +148 -0
- RinUI/components/BasicInput/CheckBox.qml +99 -0
- RinUI/components/BasicInput/ComboBox.qml +160 -0
- RinUI/components/BasicInput/DropDownButton.qml +21 -0
- RinUI/components/BasicInput/Hyperlink.qml +18 -0
- RinUI/components/BasicInput/RadioButton.qml +95 -0
- RinUI/components/BasicInput/Slider.qml +212 -0
- RinUI/components/BasicInput/Switch.qml +102 -0
- RinUI/components/BasicInput/ToggleButton.qml +11 -0
- RinUI/components/BasicInput/ToolButton.qml +31 -0
- RinUI/components/ContextMenu.qml +184 -0
- RinUI/components/DateAndTime/PickerView.qml +217 -0
- RinUI/components/DateAndTime/TimePicker.qml +115 -0
- RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -0
- RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -0
- RinUI/components/DialogsAndFlyouts/Flyout.qml +144 -0
- RinUI/components/DialogsAndFlyouts/Popup.qml +106 -0
- RinUI/components/FocusIndicator.qml +33 -0
- RinUI/components/IconWidget.qml +52 -0
- RinUI/components/Indicator.qml +90 -0
- RinUI/components/Layout/Expander.qml +160 -0
- RinUI/components/Layout/SettingExpander.qml +67 -0
- RinUI/components/Layout/SettingItem.qml +71 -0
- RinUI/components/ListAndCollections/Clip.qml +22 -0
- RinUI/components/ListAndCollections/Frame.qml +44 -0
- RinUI/components/ListAndCollections/ListView.qml +105 -0
- RinUI/components/ListAndCollections/ListViewDelegate.qml +83 -0
- RinUI/components/ListAndCollections/SettingCard.qml +73 -0
- RinUI/components/ListAndCollections/TableView.qml +82 -0
- RinUI/components/ListAndCollections/TableViewDelegate.qml +89 -0
- RinUI/components/MenusAndToolbars/Menu.qml +149 -0
- RinUI/components/MenusAndToolbars/MenuBar.qml +43 -0
- RinUI/components/MenusAndToolbars/MenuItem.qml +119 -0
- RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -0
- RinUI/components/MenusAndToolbars/MenuSeparator.qml +14 -0
- RinUI/components/MenusAndToolbars/ToolSeparator.qml +17 -0
- RinUI/components/Navigation/ErrorPage.qml +48 -0
- RinUI/components/Navigation/NavigationBar.qml +179 -0
- RinUI/components/Navigation/NavigationItem.qml +193 -0
- RinUI/components/Navigation/NavigationSubItem.qml +103 -0
- RinUI/components/Navigation/NavigationView.qml +210 -0
- RinUI/components/Navigation/SelectorBar.qml +58 -0
- RinUI/components/ScrollBar.qml +163 -0
- RinUI/components/ScrollView.qml +13 -0
- RinUI/components/Shadow.qml +48 -0
- RinUI/components/StatusAndInfo/InfoBadge.qml +78 -0
- RinUI/components/StatusAndInfo/InfoBar.qml +246 -0
- RinUI/components/StatusAndInfo/ProgressBar.qml +127 -0
- RinUI/components/StatusAndInfo/Toast.qml +237 -0
- RinUI/components/StatusAndInfo/ToolTip.qml +93 -0
- RinUI/components/Text/SpinBox.qml +134 -0
- RinUI/components/Text/Text.qml +44 -0
- RinUI/components/Text/TextField.qml +94 -0
- RinUI/components/Text/TextInput.qml +29 -0
- RinUI/components/Utils/Blur.qml +42 -0
- RinUI/components/qmldir +76 -0
- RinUI/config/rin_ui.json +8 -0
- RinUI/core/__init__.py +3 -0
- 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/config.py +109 -0
- RinUI/core/launcher.py +144 -0
- RinUI/core/theme.py +342 -0
- RinUI/hooks/__init__.py +3 -0
- RinUI/hooks/hook-RinUI.py +3 -0
- RinUI/qmldir +92 -0
- RinUI/themes/dark.qml +137 -0
- RinUI/themes/light.qml +137 -0
- RinUI/themes/qmldir +7 -0
- RinUI/themes/theme.qml +126 -0
- RinUI/themes/utils.qml +28 -0
- RinUI/utils/Animation.qml +12 -0
- RinUI/utils/FloatLayer.qml +123 -0
- RinUI/utils/FontIconLoader.qml +14 -0
- RinUI/utils/Position.qml +19 -0
- RinUI/utils/Severity.qml +13 -0
- RinUI/utils/Typography.qml +17 -0
- RinUI/utils/qmldir +5 -0
- RinUI/windows/CtrlBtn.qml +119 -0
- RinUI/windows/FluentPage.qml +92 -0
- RinUI/windows/FluentWindow.qml +32 -0
- RinUI/windows/FluentWindowBase.qml +157 -0
- RinUI/windows/TitleBar.qml +132 -0
- RinUI/windows/qmldir +8 -0
- RinUI/windows/window/ApplicationWindow.qml +9 -0
- RinUI/windows/window/Window.qml +112 -0
- rinui-0.0.9.data/data/LICENSE +21 -0
- rinui-0.0.9.data/data/README.md +90 -0
- rinui-0.0.9.dist-info/LICENSE +21 -0
- rinui-0.0.9.dist-info/METADATA +105 -0
- rinui-0.0.9.dist-info/RECORD +102 -0
- rinui-0.0.9.dist-info/WHEEL +5 -0
- rinui-0.0.9.dist-info/entry_points.txt +2 -0
- rinui-0.0.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,212 @@
|
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls.Basic 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
// thanks JerryQAQ
|
7
|
+
|
8
|
+
Slider {
|
9
|
+
id: root
|
10
|
+
// 尺寸属性
|
11
|
+
property real handleSize: Theme.currentTheme.appearance.sliderHandleSize // 手柄基础尺寸
|
12
|
+
property real borderWidth: 3 // 边框宽度
|
13
|
+
property int ticksPadding: 4 // 刻度线间距
|
14
|
+
property real trackHeight: 4
|
15
|
+
property bool showTooltip: true
|
16
|
+
property bool tickmarks: false
|
17
|
+
property real tickFrequency: 0 // 刻度线频率
|
18
|
+
property color primaryColor: Theme.currentTheme.colors.primaryColor
|
19
|
+
|
20
|
+
// accessibility
|
21
|
+
FocusIndicator {
|
22
|
+
control: parent
|
23
|
+
}
|
24
|
+
|
25
|
+
// auto enable snap
|
26
|
+
snapMode: Slider.SnapAlways
|
27
|
+
|
28
|
+
// 自适应高度和宽度
|
29
|
+
implicitHeight: orientation === Qt.Horizontal ? 32 : 150
|
30
|
+
implicitWidth: orientation === Qt.Horizontal ? 150 : 32
|
31
|
+
|
32
|
+
|
33
|
+
// Background / 背景 //
|
34
|
+
background: Rectangle {
|
35
|
+
anchors.centerIn: parent
|
36
|
+
width: root.orientation === Qt.Horizontal ? parent.width - handle.width : trackHeight
|
37
|
+
height: root.orientation === Qt.Horizontal ? trackHeight : parent.height - handle.width
|
38
|
+
radius: 99
|
39
|
+
color: Theme.currentTheme.colors.controlStrongColor
|
40
|
+
|
41
|
+
Behavior on color {
|
42
|
+
ColorAnimation {
|
43
|
+
duration: Utils.appearanceSpeed
|
44
|
+
easing.type: Easing.OutQuart
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// 进度条
|
49
|
+
Rectangle {
|
50
|
+
width: root.orientation === Qt.Horizontal ? root.visualPosition * parent.width : trackHeight
|
51
|
+
height: root.orientation === Qt.Horizontal ? trackHeight : (1 - root.visualPosition) * parent.height
|
52
|
+
anchors.bottom: root.orientation === Qt.Vertical ? parent.bottom : undefined
|
53
|
+
radius: 99
|
54
|
+
color: Theme.currentTheme.colors.primaryColor
|
55
|
+
|
56
|
+
Behavior on width {
|
57
|
+
NumberAnimation {
|
58
|
+
duration: Utils.animationSpeedFaster
|
59
|
+
easing.type: Easing.OutCubic
|
60
|
+
}
|
61
|
+
}
|
62
|
+
Behavior on color {
|
63
|
+
ColorAnimation {
|
64
|
+
duration: Utils.appearanceSpeed
|
65
|
+
easing.type: Easing.OutQuart
|
66
|
+
}
|
67
|
+
}
|
68
|
+
Behavior on height {
|
69
|
+
NumberAnimation {
|
70
|
+
duration: Utils.animationSpeedFaster
|
71
|
+
easing.type: Easing.OutCubic
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// 刻度线 / Repeater //
|
77
|
+
Repeater {
|
78
|
+
model: (to - from) / (tickFrequency !== 0 ? tickFrequency : stepSize)
|
79
|
+
|
80
|
+
delegate: Column {
|
81
|
+
x: root.orientation === Qt.Horizontal ?
|
82
|
+
index * parent.width / (to - from) * (tickFrequency !== 0 ? tickFrequency : stepSize) - width / 2
|
83
|
+
: ticksPadding + trackHeight
|
84
|
+
y: root.orientation === Qt.Vertical ?
|
85
|
+
index * parent.height / (to - from) * (tickFrequency !== 0 ? tickFrequency : stepSize) - height / 2
|
86
|
+
: ticksPadding + trackHeight
|
87
|
+
spacing: 2
|
88
|
+
Rectangle {
|
89
|
+
anchors.horizontalCenter: parent.horizontalCenter
|
90
|
+
width: root.orientation === Qt.Horizontal ? 1 : 4
|
91
|
+
height: root.orientation === Qt.Horizontal ? 4 : 1
|
92
|
+
color: Theme.currentTheme.colors.controlStrongColor
|
93
|
+
|
94
|
+
visible: root.tickmarks && index !== 0 && index !== ((to - from) / stepSize)
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
// 手柄 / Handle //
|
102
|
+
handle: Item {
|
103
|
+
id: handle
|
104
|
+
property bool hovered: false
|
105
|
+
width: handleSize + 2
|
106
|
+
height: handleSize + 2
|
107
|
+
|
108
|
+
// 动态调整手柄位置:根据 orientation 切换 x/y 轴逻辑
|
109
|
+
x: root.orientation === Qt.Horizontal
|
110
|
+
? root.visualPosition * (parent.width - width) // 横向:x 受 visualPosition 控制
|
111
|
+
: (parent.width - width) / 2 // 竖向
|
112
|
+
y: root.orientation === Qt.Vertical
|
113
|
+
? (root.visualPosition) * (parent.height - height) // 竖向:y 受 visualPosition 控制
|
114
|
+
: (parent.height - height) / 2 // 横向
|
115
|
+
|
116
|
+
|
117
|
+
ToolTip {
|
118
|
+
text: root.value.toString()
|
119
|
+
visible: root.showTooltip ? (handle.hovered || root.pressed) : false
|
120
|
+
delay: 50
|
121
|
+
}
|
122
|
+
|
123
|
+
// MouseArea
|
124
|
+
MouseArea {
|
125
|
+
anchors.fill: parent
|
126
|
+
hoverEnabled: true
|
127
|
+
acceptedButtons: Qt.NoButton
|
128
|
+
onEntered: handle.hovered = true
|
129
|
+
onExited: handle.hovered = false
|
130
|
+
}
|
131
|
+
|
132
|
+
// border
|
133
|
+
Rectangle {
|
134
|
+
anchors.fill: parent
|
135
|
+
radius: width / 2
|
136
|
+
color: Theme.currentTheme.colors.controlQuaternaryColor
|
137
|
+
}
|
138
|
+
|
139
|
+
// border middle(?)
|
140
|
+
Rectangle {
|
141
|
+
anchors.centerIn: parent
|
142
|
+
width: handleSize
|
143
|
+
height: handleSize
|
144
|
+
radius: width / 2
|
145
|
+
color: Theme.currentTheme.colors.controlSolidColor
|
146
|
+
|
147
|
+
Behavior on color {
|
148
|
+
ColorAnimation {
|
149
|
+
duration: Utils.appearanceSpeed
|
150
|
+
easing.type: Easing.OutQuart
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
// dot 主题色圆点
|
156
|
+
Rectangle {
|
157
|
+
id: dot
|
158
|
+
anchors.centerIn: parent
|
159
|
+
// 取偶数
|
160
|
+
width: Math.round(handleSize * 0.55) & ~1
|
161
|
+
height: Math.round(handleSize * 0.55) & ~1
|
162
|
+
radius: width / 2
|
163
|
+
|
164
|
+
// 悬停
|
165
|
+
scale: root.pressed ? 0.83 :
|
166
|
+
handle.hovered ? 1.16 : 1.0
|
167
|
+
color: root.pressed ? Qt.alpha(Theme.currentTheme.colors.primaryColor, 0.8) :
|
168
|
+
handle.hovered ? Qt.alpha(Theme.currentTheme.colors.primaryColor, 0.9) : Theme.currentTheme.colors.primaryColor
|
169
|
+
|
170
|
+
// 动画
|
171
|
+
Behavior on color {
|
172
|
+
ColorAnimation {
|
173
|
+
duration: Utils.appearanceSpeed
|
174
|
+
easing.type: Easing.OutCubic
|
175
|
+
}
|
176
|
+
}
|
177
|
+
Behavior on scale {
|
178
|
+
NumberAnimation {
|
179
|
+
duration: Utils.animationSpeed
|
180
|
+
easing.type: Easing.OutBack
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
Behavior on x {
|
186
|
+
NumberAnimation {
|
187
|
+
duration: Utils.animationSpeedFaster
|
188
|
+
easing.type: Easing.OutCubic
|
189
|
+
}
|
190
|
+
}
|
191
|
+
Behavior on y {
|
192
|
+
NumberAnimation {
|
193
|
+
duration: Utils.animationSpeedFaster
|
194
|
+
easing.type: Easing.OutCubic
|
195
|
+
}
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
// 状态管理
|
201
|
+
states: [
|
202
|
+
State {
|
203
|
+
name: "disabled"
|
204
|
+
when: !root.enabled
|
205
|
+
PropertyChanges {
|
206
|
+
target: handle
|
207
|
+
color: Theme.currentTheme.colors.textDisabled
|
208
|
+
opacity: 0.6
|
209
|
+
}
|
210
|
+
}
|
211
|
+
]
|
212
|
+
}
|
@@ -0,0 +1,102 @@
|
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import "../../themes"
|
4
|
+
import "../../components"
|
5
|
+
|
6
|
+
|
7
|
+
Switch {
|
8
|
+
id: root
|
9
|
+
|
10
|
+
// width: 40
|
11
|
+
implicitHeight: 20
|
12
|
+
|
13
|
+
property color backgroundColor: Theme.currentTheme.colors.controlSecondaryColor
|
14
|
+
property color primaryColor: Theme.currentTheme.colors.primaryColor
|
15
|
+
property string checkedText: qsTr("On")
|
16
|
+
property string uncheckedText: qsTr("Off")
|
17
|
+
|
18
|
+
// accessibility
|
19
|
+
FocusIndicator {
|
20
|
+
control: parent
|
21
|
+
// radius: 999
|
22
|
+
}
|
23
|
+
|
24
|
+
// 背景 / Background
|
25
|
+
background: Rectangle {
|
26
|
+
id: background
|
27
|
+
width: 40
|
28
|
+
height: 20
|
29
|
+
radius: height / 2
|
30
|
+
color: checked ? primaryColor :
|
31
|
+
hovered ? Theme.currentTheme.colors.controlTertiaryColor : backgroundColor
|
32
|
+
|
33
|
+
// 边框 / Border
|
34
|
+
border.color: checked ? "transparent" : Theme.currentTheme.colors.controlBorderStrongColor
|
35
|
+
border.width: Theme.currentTheme.appearance.borderWidth
|
36
|
+
|
37
|
+
Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
|
38
|
+
}
|
39
|
+
|
40
|
+
// 指示器 / Indicator //
|
41
|
+
indicator: Rectangle {
|
42
|
+
id: indicator
|
43
|
+
width: pressed && enabled ? background.height - 3:
|
44
|
+
hovered && enabled ? background.height - 3 * 2 : background.height - 4 * 2
|
45
|
+
height: (hovered || pressed) && enabled ? background.height - 3 * 2 : background.height - 4 * 2
|
46
|
+
|
47
|
+
anchors.verticalCenter: background.verticalCenter
|
48
|
+
radius: height / 2
|
49
|
+
color: checked ? Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.controlBorderStrongColor
|
50
|
+
|
51
|
+
Behavior on color { ColorAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuart } }
|
52
|
+
|
53
|
+
Behavior on x { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
54
|
+
Behavior on height { NumberAnimation { duration: Utils.animationSpeed; easing.type: Easing.OutQuint } }
|
55
|
+
|
56
|
+
x: (hovered || pressed) && enabled
|
57
|
+
? visualPosition * (background.width - 3 - width) + (checked ? 0 : 3)
|
58
|
+
: visualPosition * (background.width - 8 - width) + 4
|
59
|
+
}
|
60
|
+
|
61
|
+
contentItem: Row {
|
62
|
+
anchors.fill: parent
|
63
|
+
spacing: 12
|
64
|
+
Rectangle { width: 40; height: 20; color: "transparent" } // 占位符
|
65
|
+
|
66
|
+
Text {
|
67
|
+
text: (root.text === '') ? root.checked ? checkedText : uncheckedText : root.text
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
// 状态变化
|
72
|
+
states: [
|
73
|
+
State {
|
74
|
+
name: "disabledSwitch"
|
75
|
+
when: !root.enabled
|
76
|
+
PropertyChanges {
|
77
|
+
target: root
|
78
|
+
opacity: 0.2169
|
79
|
+
primaryColor: Theme.currentTheme.colors.disabledColor
|
80
|
+
}
|
81
|
+
},
|
82
|
+
State {
|
83
|
+
name: "pressedSwitch"
|
84
|
+
when: pressed
|
85
|
+
PropertyChanges {
|
86
|
+
target: background
|
87
|
+
opacity: 0.8
|
88
|
+
}
|
89
|
+
},
|
90
|
+
State {
|
91
|
+
name: "hoveredSwitch"
|
92
|
+
when: hovered
|
93
|
+
PropertyChanges {
|
94
|
+
target: background
|
95
|
+
opacity: 0.9
|
96
|
+
}
|
97
|
+
}
|
98
|
+
]
|
99
|
+
|
100
|
+
// 动画
|
101
|
+
Behavior on opacity { NumberAnimation { duration: Utils.appearanceSpeed; easing.type: Easing.OutQuart } }
|
102
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import "../../components"
|
4
|
+
|
5
|
+
Button {
|
6
|
+
id: toolBtn
|
7
|
+
// flat: true
|
8
|
+
property alias size: iconWidget.size
|
9
|
+
property alias color: iconWidget.color
|
10
|
+
// width: height * 1
|
11
|
+
|
12
|
+
contentItem: Item {
|
13
|
+
width: parent.width
|
14
|
+
height: parent.height
|
15
|
+
Text {
|
16
|
+
anchors.centerIn: parent
|
17
|
+
id: btnText
|
18
|
+
text: toolBtn.text
|
19
|
+
}
|
20
|
+
IconWidget {
|
21
|
+
id: iconWidget
|
22
|
+
width: parent.width
|
23
|
+
height: parent.height
|
24
|
+
size: 20
|
25
|
+
icon: toolBtn.icon.name ? toolBtn.icon.name : toolBtn.text
|
26
|
+
color: icon.color ? icon.color : highlighted ? flat ?
|
27
|
+
enabled ? Theme.currentTheme.colors.textAccentColor : Theme.currentTheme.colors.textColor :
|
28
|
+
Theme.currentTheme.colors.textOnAccentColor : Theme.currentTheme.colors.textColor
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,184 @@
|
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls.Basic 2.15
|
3
|
+
import "../themes"
|
4
|
+
import "../components"
|
5
|
+
|
6
|
+
|
7
|
+
Popup {
|
8
|
+
id: contextMenu
|
9
|
+
|
10
|
+
// 选中信号 / Signal //
|
11
|
+
signal itemSelected(int index)
|
12
|
+
|
13
|
+
property alias model: listView.model
|
14
|
+
property alias currentIndex: listView.currentIndex
|
15
|
+
property int maxHeight: 300 // 最大高度
|
16
|
+
property string textRole: ""
|
17
|
+
property bool keyboardNavigation: false
|
18
|
+
|
19
|
+
implicitWidth: 100
|
20
|
+
implicitHeight: Math.min(listView.contentHeight + 6, maxHeight)
|
21
|
+
y: (parent.height - contextMenu.height) / 2
|
22
|
+
height: implicitHeight // 保持隐式绑定
|
23
|
+
closePolicy: Popup.CloseOnPressOutside
|
24
|
+
focus: true
|
25
|
+
|
26
|
+
// 内容 / ListView //
|
27
|
+
contentItem: ListView {
|
28
|
+
id: listView
|
29
|
+
clip: true
|
30
|
+
focus: true
|
31
|
+
spacing: 0
|
32
|
+
anchors.fill: parent // 清除边距
|
33
|
+
anchors.topMargin: 2
|
34
|
+
anchors.bottomMargin: 2
|
35
|
+
|
36
|
+
// 垂直滚动条 / Vertical ScrollBar //
|
37
|
+
ScrollBar.vertical: ScrollBar {
|
38
|
+
id: scrollBar
|
39
|
+
policy: ScrollBar.AsNeeded
|
40
|
+
}
|
41
|
+
model: control.popup.visible ? control.delegateModel : null
|
42
|
+
|
43
|
+
// 选择器 / Selection //
|
44
|
+
delegate: ItemDelegate {
|
45
|
+
id: delegate
|
46
|
+
width: listView.width
|
47
|
+
height: text.implicitHeight + 20 // 自适应
|
48
|
+
highlighted: ListView.isCurrentItem // 当前项高亮
|
49
|
+
focusPolicy: Qt.StrongFocus
|
50
|
+
|
51
|
+
background: Rectangle {
|
52
|
+
id: itemBg
|
53
|
+
anchors.fill: parent
|
54
|
+
anchors.leftMargin: 5
|
55
|
+
anchors.rightMargin: 5
|
56
|
+
anchors.topMargin: 3
|
57
|
+
radius: Theme.currentTheme.appearance.buttonRadius
|
58
|
+
color: pressed
|
59
|
+
? Theme.currentTheme.colors.subtleTertiaryColor
|
60
|
+
: (highlighted || hovered)
|
61
|
+
? Theme.currentTheme.colors.subtleSecondaryColor
|
62
|
+
: Theme.currentTheme.colors.subtleColor
|
63
|
+
|
64
|
+
Text {
|
65
|
+
id: text
|
66
|
+
anchors.fill: parent
|
67
|
+
anchors.leftMargin: 11
|
68
|
+
anchors.rightMargin: 11
|
69
|
+
anchors.topMargin: 6
|
70
|
+
anchors.bottomMargin: 8
|
71
|
+
verticalAlignment: Text.AlignVCenter
|
72
|
+
|
73
|
+
typography: Typography.Body
|
74
|
+
wrapMode: Text.Wrap
|
75
|
+
text: model[contextMenu.parent.textRole]
|
76
|
+
}
|
77
|
+
|
78
|
+
// 选择指示器
|
79
|
+
Indicator {
|
80
|
+
currentItemHeight: itemBg.height
|
81
|
+
visible: highlighted
|
82
|
+
}
|
83
|
+
|
84
|
+
// accessibility
|
85
|
+
FocusIndicator {
|
86
|
+
control: parent
|
87
|
+
visible: highlighted && keyboardNavigation
|
88
|
+
}
|
89
|
+
|
90
|
+
Behavior on color { ColorAnimation { duration: Utils.appearanceSpeed; easing.type:Easing.InOutQuart } }
|
91
|
+
}
|
92
|
+
|
93
|
+
Keys.onUpPressed: {
|
94
|
+
contextMenu.keyboardNavigation = true
|
95
|
+
listView.decrementCurrentIndex()
|
96
|
+
}
|
97
|
+
|
98
|
+
Keys.onDownPressed: {
|
99
|
+
contextMenu.keyboardNavigation = true
|
100
|
+
listView.incrementCurrentIndex()
|
101
|
+
}
|
102
|
+
|
103
|
+
onClicked: {
|
104
|
+
listView.currentIndex = index
|
105
|
+
contextMenu.itemSelected(index)
|
106
|
+
contextMenu.close()
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
// 背景 / Background //
|
112
|
+
background: Rectangle {
|
113
|
+
id: background
|
114
|
+
anchors.fill: parent
|
115
|
+
radius: Theme.currentTheme.appearance.windowRadius
|
116
|
+
color: Theme.currentTheme.colors.backgroundAcrylicColor
|
117
|
+
border.color: Theme.currentTheme.colors.controlBorderColor
|
118
|
+
|
119
|
+
// 阴影 / Shadow //
|
120
|
+
layer.enabled: true
|
121
|
+
layer.effect: Shadow {
|
122
|
+
id: shadow
|
123
|
+
style: "flyout"
|
124
|
+
source: background
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
// 按钮 / Button //
|
129
|
+
|
130
|
+
|
131
|
+
Behavior on y { NumberAnimation { duration: Utils.animationSpeed; easing.type:Easing.InOutQuart } }
|
132
|
+
|
133
|
+
enter: Transition {
|
134
|
+
ParallelAnimation {
|
135
|
+
NumberAnimation {
|
136
|
+
target: contextMenu
|
137
|
+
property: "opacity"
|
138
|
+
from: 0
|
139
|
+
to: 1
|
140
|
+
duration: 70
|
141
|
+
easing.type: Easing.InOutQuart
|
142
|
+
}
|
143
|
+
// NumberAnimation {
|
144
|
+
// target: shadow
|
145
|
+
// property: "opacity"
|
146
|
+
// from: 0
|
147
|
+
// to: 1
|
148
|
+
// duration: 600
|
149
|
+
// easing.type: Easing.InOutCubic
|
150
|
+
// }
|
151
|
+
NumberAnimation {
|
152
|
+
target: scrollBar
|
153
|
+
property: "opacity"
|
154
|
+
from: 0
|
155
|
+
to: 1
|
156
|
+
duration: 1000
|
157
|
+
easing.type: Easing.InOutCubic
|
158
|
+
}
|
159
|
+
NumberAnimation {
|
160
|
+
target: contextMenu
|
161
|
+
property: "height"
|
162
|
+
from: 46
|
163
|
+
to: contextMenu.implicitHeight
|
164
|
+
duration: Utils.animationSpeedMiddle
|
165
|
+
easing.type: Easing.OutQuint
|
166
|
+
onRunningChanged: {
|
167
|
+
scrollBar.visible = true;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
}
|
171
|
+
}
|
172
|
+
exit: Transition {
|
173
|
+
ParallelAnimation {
|
174
|
+
NumberAnimation {
|
175
|
+
target: contextMenu
|
176
|
+
property: "opacity"
|
177
|
+
from: 1
|
178
|
+
to: 0
|
179
|
+
duration: 150
|
180
|
+
easing.type: Easing.InOutQuart
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|