Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
ec944da9
P
PyQt Fluent Widgets
项目概览
k54kdk
/
PyQt Fluent Widgets
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PyQt Fluent Widgets
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
ec944da9
编写于
6月 22, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整补全菜单的选中样式
上级
a02ea848
变更
22
展开全部
隐藏空白更改
内联
并排
Showing
22 changed file
with
291682 addition
and
291381 deletion
+291682
-291381
examples/gallery/app/common/resource.py
examples/gallery/app/common/resource.py
+216085
-216003
examples/gallery/app/resource/i18n/gallery.zh_CN.qm
examples/gallery/app/resource/i18n/gallery.zh_CN.qm
+0
-0
examples/gallery/app/resource/i18n/gallery.zh_CN.ts
examples/gallery/app/resource/i18n/gallery.zh_CN.ts
+81
-46
examples/gallery/app/resource/i18n/gallery.zh_HK.qm
examples/gallery/app/resource/i18n/gallery.zh_HK.qm
+0
-0
examples/gallery/app/resource/i18n/gallery.zh_HK.ts
examples/gallery/app/resource/i18n/gallery.zh_HK.ts
+105
-70
examples/gallery/app/view/basic_input_interface.py
examples/gallery/app/view/basic_input_interface.py
+61
-5
examples/gallery/app/view/home_interface.py
examples/gallery/app/view/home_interface.py
+16
-8
examples/gallery/app/view/navigation_view_interface.py
examples/gallery/app/view/navigation_view_interface.py
+2
-2
examples/gallery/app/view/text_interface.py
examples/gallery/app/view/text_interface.py
+39
-2
examples/segmented_widget/demo.py
examples/segmented_widget/demo.py
+0
-0
qfluentwidgets/_rc/qss/dark/button.qss
qfluentwidgets/_rc/qss/dark/button.qss
+9
-0
qfluentwidgets/_rc/qss/dark/combo_box.qss
qfluentwidgets/_rc/qss/dark/combo_box.qss
+0
-40
qfluentwidgets/_rc/qss/dark/menu.qss
qfluentwidgets/_rc/qss/dark/menu.qss
+2
-7
qfluentwidgets/_rc/qss/light/combo_box.qss
qfluentwidgets/_rc/qss/light/combo_box.qss
+0
-40
qfluentwidgets/_rc/qss/light/menu.qss
qfluentwidgets/_rc/qss/light/menu.qss
+2
-7
qfluentwidgets/_rc/resource.py
qfluentwidgets/_rc/resource.py
+75232
-75103
qfluentwidgets/components/navigation/pivot.py
qfluentwidgets/components/navigation/pivot.py
+1
-1
qfluentwidgets/components/navigation/segmented_widget.py
qfluentwidgets/components/navigation/segmented_widget.py
+0
-12
qfluentwidgets/components/widgets/__init__.py
qfluentwidgets/components/widgets/__init__.py
+2
-1
qfluentwidgets/components/widgets/combo_box.py
qfluentwidgets/components/widgets/combo_box.py
+4
-22
qfluentwidgets/components/widgets/line_edit.py
qfluentwidgets/components/widgets/line_edit.py
+20
-10
qfluentwidgets/components/widgets/menu.py
qfluentwidgets/components/widgets/menu.py
+21
-2
未找到文件。
examples/gallery/app/common/resource.py
浏览文件 @
ec944da9
此差异已折叠。
点击以展开。
examples/gallery/app/resource/i18n/gallery.zh_CN.qm
浏览文件 @
ec944da9
无法预览此类型文件
examples/gallery/app/resource/i18n/gallery.zh_CN.ts
浏览文件 @
ec944da9
...
...
@@ -4,215 +4,250 @@
<
context
>
<
name
>
BasicInputInterface
<
/name
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
5
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
7
"
/>
<
source
>
A
simple
button
with
text
content
<
/source
>
<
translation
>
带有文本的简单按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
3
5
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
3
7
"
/>
<
source
>
A
button
with
graphical
content
<
/source
>
<
translation
>
带有图标的按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
56
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
170
"
/>
<
source
>
A
hyperlink
button
that
navigates
to
a
URI
<
/source
>
<
translation
>
导航到一个超链接的按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
63
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
72
"
/>
<
source
>
A
2
-
state
CheckBox
<
/source
>
<
translation
>
双态复选框
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
72
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
81
"
/>
<
source
>
A
3
-
state
CheckBox
<
/source
>
<
translation
>
三态复选框
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
83
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
92
"
/>
<
source
>
A
ComboBox
with
items
<
/source
>
<
translation
>
下拉框
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
58
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
92
"
/>
<
source
>
A
group
of
RadioButton
controls
in
a
button
group
<
/source
>
<
translation
>
单选按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
169
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
203
"
/>
<
source
>
A
simple
horizontal
slider
<
/source
>
<
translation
>
水平滑动条
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
20
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
54
"
/>
<
source
>
A
simple
switch
button
<
/source
>
<
translation
>
开关按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
37
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
93
"
/>
<
source
>
Off
<
/source
>
<
translation
>
关
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
35
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
91
"
/>
<
source
>
On
<
/source
>
<
translation
>
开
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
25
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
58
"
/>
<
source
>
Standard
push
button
<
/source
>
<
translation
>
标准按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
4
2
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
4
4
"
/>
<
source
>
Accent
style
button
<
/source
>
<
translation
>
主题色按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
63
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
72
"
/>
<
source
>
Two
-
state
CheckBox
<
/source
>
<
translation
>
双态复选框
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
7
0
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
7
9
"
/>
<
source
>
Three
-
state
CheckBox
<
/source
>
<
translation
>
三态复选框
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
56
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
170
"
/>
<
source
>
GitHub
home
page
<
/source
>
<
translation
>
GItHub
主页
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
41
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
97
"
/>
<
source
>
Star
Platinum
<
/source
>
<
translation
>
白金之星
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
41
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
97
"
/>
<
source
>
Crazy
Diamond
<
/source
>
<
translation
>
疯狂钻石
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
49
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
83
"
/>
<
source
>
Soft
and
Wet
<
/source
>
<
translation
>
软又湿
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
41
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
97
"
/>
<
source
>
Gold
Experience
<
/source
>
<
translation
>
黄金体验
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
41
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
97
"
/>
<
source
>
Sticky
Fingers
<
/source
>
<
translation
>
钢链手指
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
01
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
35
"
/>
<
source
>
Choose
your
stand
<
/source
>
<
translation
>
选择你的替身
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
99
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
108
"
/>
<
source
>
An
editable
ComboBox
<
/source
>
<
translation
>
可编辑的下拉框
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
07
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
16
"
/>
<
source
>
Send
<
/source
>
<
translation
>
发送
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
08
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
17
"
/>
<
source
>
Save
<
/source
>
<
translation
>
保存
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
26
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
52
"
/>
<
source
>
Email
<
/source
>
<
translation
>
邮件
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
11
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
20
"
/>
<
source
>
A
push
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
19
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
28
"
/>
<
source
>
A
tool
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
227
"
/>
<
source
>
A
simple
ToggleButton
with
text
content
<
/source
>
<
translation
>
带文本的状态开关按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
227
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
275
"
/>
<
source
>
Start
practicing
<
/source
>
<
translation
>
开始练习
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
178
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
212
"
/>
<
source
>
A
split
push
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的拆分按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
185
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
219
"
/>
<
source
>
Sing
<
/source
>
<
translation
>
唱
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
185
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
219
"
/>
<
source
>
Jump
<
/source
>
<
translation
>
跳
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
185
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
219
"
/>
<
source
>
Rap
<
/source
>
<
translation
>
Rap
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
185
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
219
"
/>
<
source
>
Music
<
/source
>
<
translation
>
Music
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
194
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
228
"
/>
<
source
>
A
split
tool
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
4
2
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
4
4
"
/>
<
source
>
Accent
style
applied
to
push
button
<
/source
>
<
translation
>
主题色按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
49
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
51
"
/>
<
source
>
Accent
style
applied
to
tool
button
<
/source
>
<
translation
>
主题色工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
28
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
37
"
/>
<
source
>
A
primary
color
push
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的主题色按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
36
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
1
45
"
/>
<
source
>
A
primary
color
tool
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的主题色工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
03
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
37
"
/>
<
source
>
A
primary
color
split
push
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的主题色拆分按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
11
"
/>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
2
45
"
/>
<
source
>
A
primary
color
split
tool
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的主题色拆分工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
58
"
/>
<
source
>
A
transparent
push
button
<
/source
>
<
translation
>
透明按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
65
"
/>
<
source
>
A
transparent
tool
button
<
/source
>
<
translation
>
透明工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
154
"
/>
<
source
>
A
transparent
push
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的透明按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
163
"
/>
<
source
>
A
transparent
tool
button
with
drop
down
menu
<
/source
>
<
translation
>
带下拉菜单的透明工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
261
"
/>
<
source
>
A
simple
toggle
push
button
<
/source
>
<
translation
>
状态开关按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
268
"
/>
<
source
>
A
simple
toggle
tool
button
<
/source
>
<
translation
>
状态开关工具按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
275
"
/>
<
source
>
A
transparent
toggle
push
button
<
/source
>
<
translation
>
透明的状态开关按钮
<
/translation
>
<
/message
>
<
message
>
<
location
filename
=
"
../../view/basic_input_interface.py
"
line
=
"
282
"
/>
<
source
>
A
transparent
toggle
tool
button
<
/source
>
<
translation
>
透明的状态开关工具按钮
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
DateTimeInterface
<
/name
>
...
...
examples/gallery/app/resource/i18n/gallery.zh_HK.qm
浏览文件 @
ec944da9
无法预览此类型文件
examples/gallery/app/resource/i18n/gallery.zh_HK.ts
浏览文件 @
ec944da9
此差异已折叠。
点击以展开。
examples/gallery/app/view/basic_input_interface.py
浏览文件 @
ec944da9
...
...
@@ -4,7 +4,9 @@ from PyQt5.QtWidgets import QAction, QWidget, QVBoxLayout, QButtonGroup
from
qfluentwidgets
import
(
Action
,
DropDownPushButton
,
DropDownToolButton
,
PushButton
,
ToolButton
,
PrimaryPushButton
,
HyperlinkButton
,
ComboBox
,
RadioButton
,
CheckBox
,
Slider
,
SwitchButton
,
EditableComboBox
,
ToggleButton
,
RoundMenu
,
FluentIcon
,
SplitPushButton
,
SplitToolButton
,
PrimarySplitToolButton
,
PrimarySplitPushButton
,
PrimaryDropDownPushButton
,
PrimaryToolButton
,
PrimaryDropDownToolButton
)
PrimarySplitPushButton
,
PrimaryDropDownPushButton
,
PrimaryToolButton
,
PrimaryDropDownToolButton
,
ToggleToolButton
,
TransparentDropDownPushButton
,
TransparentPushButton
,
TransparentToggleToolButton
,
TransparentTogglePushButton
,
TransparentDropDownToolButton
,
TransparentToolButton
)
from
.gallery_interface
import
GalleryInterface
from
..common.translator
import
Translator
...
...
@@ -52,10 +54,17 @@ class BasicInputInterface(GalleryInterface):
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
#
hyperlink
button
#
transparent push
button
self
.
addExampleCard
(
self
.
tr
(
'A hyperlink button that navigates to a URI'
),
HyperlinkButton
(
'http://github.com'
,
self
.
tr
(
'GitHub home page'
)),
self
.
tr
(
'A transparent push button'
),
TransparentPushButton
(
self
.
tr
(
'Standard push button'
),
self
,
FluentIcon
.
BOOK_SHELF
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# transparent tool button
self
.
addExampleCard
(
self
.
tr
(
'A transparent tool button'
),
TransparentToolButton
(
FluentIcon
.
BOOK_SHELF
,
self
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
...
...
@@ -139,6 +148,31 @@ class BasicInputInterface(GalleryInterface):
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# transparent drop down button
button
=
TransparentDropDownPushButton
(
self
.
tr
(
'Email'
),
self
,
FluentIcon
.
MAIL
)
button
.
setMenu
(
menu
)
self
.
addExampleCard
(
self
.
tr
(
'A transparent push button with drop down menu'
),
button
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# transparent drop down tool button
button
=
TransparentDropDownToolButton
(
FluentIcon
.
MAIL
,
self
)
button
.
setMenu
(
menu
)
self
.
addExampleCard
(
self
.
tr
(
'A transparent tool button with drop down menu'
),
button
,
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# hyperlink button
self
.
addExampleCard
(
self
.
tr
(
'A hyperlink button that navigates to a URI'
),
HyperlinkButton
(
'http://github.com'
,
self
.
tr
(
'GitHub home page'
)),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# radio button
radioWidget
=
QWidget
()
radioLayout
=
QVBoxLayout
(
radioWidget
)
...
...
@@ -225,11 +259,33 @@ class BasicInputInterface(GalleryInterface):
# toggle button
self
.
addExampleCard
(
self
.
tr
(
'A simple
ToggleButton with text content
'
),
self
.
tr
(
'A simple
toggle push button
'
),
ToggleButton
(
self
.
tr
(
'Start practicing'
),
self
,
FluentIcon
.
BASKETBALL
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# toggle tool button
self
.
addExampleCard
(
self
.
tr
(
'A simple toggle tool button'
),
ToggleToolButton
(
FluentIcon
.
BASKETBALL
,
self
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# transparent toggle button
self
.
addExampleCard
(
self
.
tr
(
'A transparent toggle push button'
),
TransparentTogglePushButton
(
self
.
tr
(
'Start practicing'
),
self
,
FluentIcon
.
BASKETBALL
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
# transparent toggle tool button
self
.
addExampleCard
(
self
.
tr
(
'A transparent toggle tool button'
),
TransparentToggleToolButton
(
FluentIcon
.
BASKETBALL
,
self
),
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/button/demo.py'
)
def
onSwitchCheckedChanged
(
self
,
isChecked
):
if
isChecked
:
self
.
switchButton
.
setText
(
self
.
tr
(
'On'
))
...
...
examples/gallery/app/view/home_interface.py
浏览文件 @
ec944da9
...
...
@@ -132,7 +132,7 @@ class HomeInterface(ScrollArea):
title
=
"CheckBox"
,
content
=
self
.
tr
(
"A control that a user can select or clear."
),
routeKey
=
"basicInputInterface"
,
index
=
5
index
=
7
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/ComboBox.png"
,
...
...
@@ -140,7 +140,7 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A drop-down list of items a user can select from."
),
routeKey
=
"basicInputInterface"
,
index
=
7
index
=
9
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/DropDownButton.png"
,
...
...
@@ -148,7 +148,15 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A button that displays a flyout of choices when clicked."
),
routeKey
=
"basicInputInterface"
,
index
=
9
index
=
11
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/HyperlinkButton.png"
,
title
=
"HyperlinkButton"
,
content
=
self
.
tr
(
"A button that appears as hyperlink text, and can navigate to a URI or handle a Click event."
),
routeKey
=
"basicInputInterface"
,
index
=
16
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/RadioButton.png"
,
...
...
@@ -156,7 +164,7 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A control that allows a user to select a single option from a group of options."
),
routeKey
=
"basicInputInterface"
,
index
=
1
3
index
=
1
7
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/Slider.png"
,
...
...
@@ -164,7 +172,7 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A control that lets the user select from a range of values by moving a Thumb control along a track."
),
routeKey
=
"basicInputInterface"
,
index
=
1
4
index
=
1
8
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/SplitButton.png"
,
...
...
@@ -172,7 +180,7 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A two-part button that displays a flyout when its secondary part is clicked."
),
routeKey
=
"basicInputInterface"
,
index
=
1
5
index
=
1
9
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/ToggleSwitch.png"
,
...
...
@@ -180,7 +188,7 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A switch that can be toggled between 2 states."
),
routeKey
=
"basicInputInterface"
,
index
=
19
index
=
23
)
basicInputView
.
addSampleCard
(
icon
=
":/gallery/images/controls/ToggleButton.png"
,
...
...
@@ -188,7 +196,7 @@ class HomeInterface(ScrollArea):
content
=
self
.
tr
(
"A button that can be switched between two states like a CheckBox."
),
routeKey
=
"basicInputInterface"
,
index
=
2
0
index
=
2
4
)
self
.
vBoxLayout
.
addWidget
(
basicInputView
)
...
...
examples/gallery/app/view/navigation_view_interface.py
浏览文件 @
ec944da9
...
...
@@ -39,7 +39,7 @@ class PivotInterface(QWidget):
def
__init__
(
self
,
parent
=
None
):
super
().
__init__
(
parent
=
parent
)
self
.
setFixedSize
(
300
,
20
0
)
self
.
setFixedSize
(
300
,
14
0
)
self
.
pivot
=
self
.
Nav
(
self
)
self
.
stackedWidget
=
QStackedWidget
(
self
)
...
...
@@ -54,7 +54,7 @@ class PivotInterface(QWidget):
self
.
addSubInterface
(
self
.
albumInterface
,
'albumInterface'
,
self
.
tr
(
'Album'
))
self
.
addSubInterface
(
self
.
artistInterface
,
'artistInterface'
,
self
.
tr
(
'Artist'
))
self
.
vBoxLayout
.
addWidget
(
self
.
pivot
,
0
)
self
.
vBoxLayout
.
addWidget
(
self
.
pivot
,
0
,
Qt
.
AlignLeft
)
self
.
vBoxLayout
.
addWidget
(
self
.
stackedWidget
)
self
.
vBoxLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
)
StyleSheet
.
NAVIGATION_VIEW_INTERFACE
.
apply
(
self
)
...
...
examples/gallery/app/view/text_interface.py
浏览文件 @
ec944da9
# coding:utf-8
from
qfluentwidgets
import
LineEdit
,
SpinBox
,
DoubleSpinBox
,
TimeEdit
,
DateTimeEdit
,
DateEdit
,
TextEdit
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtWidgets
import
QCompleter
from
qfluentwidgets
import
LineEdit
,
SpinBox
,
DoubleSpinBox
,
TimeEdit
,
DateTimeEdit
,
DateEdit
,
TextEdit
,
SearchLineEdit
from
.gallery_interface
import
GalleryInterface
from
..common.translator
import
Translator
...
...
@@ -16,7 +18,7 @@ class TextInterface(GalleryInterface):
parent
=
parent
)
#
spin box
#
line edit
lineEdit
=
LineEdit
(
self
)
lineEdit
.
setText
(
self
.
tr
(
'ko no dio da!'
))
lineEdit
.
setClearButtonEnabled
(
True
)
...
...
@@ -26,6 +28,41 @@ class TextInterface(GalleryInterface):
sourcePath
=
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/line_edit/demo.py'
)
# line edit with completer
lineEdit
=
SearchLineEdit
(
self
)
lineEdit
.
setPlaceholderText
(
'Type a stand name'
)
lineEdit
.
setClearButtonEnabled
(
True
)
lineEdit
.
setFixedWidth
(
230
)
stands
=
[
"Star Platinum"
,
"Hierophant Green"
,
"Made in Haven"
,
"King Crimson"
,
"Silver Chariot"
,
"Crazy diamond"
,
"Metallica"
,
"Another One Bites The Dust"
,
"Heaven's Door"
,
"Killer Queen"
,
"The Grateful Dead"
,
"Stone Free"
,
"The World"
,
"Sticky Fingers"
,
"Ozone Baby"
,
"Love Love Deluxe"
,
"Hermit Purple"
,
"Gold Experience"
,
"King Nothing"
,
"Paper Moon King"
,
"Scary Monster"
,
"Mandom"
,
"20th Century Boy"
,
"Tusk Act 4"
,
"Ball Breaker"
,
"Sex Pistols"
,
"D4C • Love Train"
,
"Born This Way"
,
"SOFT & WET"
,
"Paisley Park"
,
"Wonder of U"
,
"Walking Heart"
,
"Cream Starter"
,
"November Rain"
,
"Smooth Operators"
,
"The Matte Kudasai"
]
completer
=
QCompleter
(
stands
,
lineEdit
)
completer
.
setCaseSensitivity
(
Qt
.
CaseInsensitive
)
lineEdit
.
setCompleter
(
completer
)
self
.
addExampleCard
(
title
=
self
.
tr
(
"A autosuggest line edit"
),
widget
=
lineEdit
,
sourcePath
=
'https://github.com/zhiyiYo/PyQt-Fluent-Widgets/blob/master/examples/line_edit/demo.py'
)
# spin box
self
.
addExampleCard
(
title
=
self
.
tr
(
"A SpinBox with a spin button"
),
...
...
examples/se
t
mented_widget/demo.py
→
examples/se
g
mented_widget/demo.py
浏览文件 @
ec944da9
文件已移动
qfluentwidgets/_rc/qss/dark/button.qss
浏览文件 @
ec944da9
...
...
@@ -223,16 +223,21 @@ RadioButton::indicator:disabled:checked {
TransparentToolButton,
TransparentToggleToolButton,
TransparentDropDownToolButton,
TransparentPushButton,
TransparentDropDownPushButton,
TransparentTogglePushButton {
background-color: transparent;
border: none;
border-radius: 4px;
margin: 0;
}
TransparentToolButton:hover,
TransparentToggleToolButton:hover,
TransparentDropDownToolButton:hover,
TransparentPushButton:hover,
TransparentDropDownPushButton:hover,
TransparentTogglePushButton:hover {
background-color: rgba(255, 255, 255, 9);
border: none;
...
...
@@ -240,7 +245,9 @@ TransparentTogglePushButton:hover {
TransparentToolButton:pressed,
TransparentToggleToolButton:pressed,
TransparentDropDownToolButton:pressed,
TransparentPushButton:pressed,
TransparentDropDownPushButton:pressed,
TransparentTogglePushButton:pressed {
background-color: rgba(255, 255, 255, 6);
border: none;
...
...
@@ -248,7 +255,9 @@ TransparentTogglePushButton:pressed {
TransparentToolButton:disabled,
TransparentToggleToolButton:disabled,
TransparentDropDownToolButton:disabled,
TransprentPushButton:disabled,
TransparentDropDownPushButton:disabled,
TransprentTogglePushButton:disabled {
background-color: transparent;
border: none;
...
...
qfluentwidgets/_rc/qss/dark/combo_box.qss
浏览文件 @
ec944da9
...
...
@@ -25,43 +25,3 @@ ComboBox:disabled {
border: 1px solid rgba(255, 255, 255, 0.053);
border-top: 1px solid rgba(255, 255, 255, 0.053);
}
ComboBoxMenu>MenuActionListWidget {
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 9px;
background-color: rgb(43, 43, 43);
outline: none;
font: 14px 'Segoe UI', 'Microsoft YaHei';
}
ComboBoxMenu>MenuActionListWidget::item {
margin-top: 4px;
padding-left: 10px;
padding-right: 10px;
border-radius: 5px;
border: none;
color: white;
}
ComboBoxMenu>MenuActionListWidget::disbled {
padding-left: 10px;
padding-right: 10px;
border-radius: 5px;
border: none;
color: white;
}
ComboBoxMenu>MenuActionListWidget::item:hover {
background-color: rgba(255, 255, 255, 0.08);
}
ComboBoxMenu>MenuActionListWidget::item:selected {
background-color: rgba(255, 255, 255, 0.08);
color: white;
}
ComboBoxMenu>MenuActionListWidget::item:selected:active {
background-color: rgba(255, 255, 255, 0.06);
color: rgba(255, 255, 255, 0.7);
}
\ No newline at end of file
qfluentwidgets/_rc/qss/dark/menu.qss
浏览文件 @
ec944da9
...
...
@@ -50,8 +50,6 @@ MenuActionListWidget::item {
border-radius: 5px;
border: none;
color: white;
margin-left: 6px;
margin-right: 6px;
}
MenuActionListWidget::item:disabled {
...
...
@@ -86,10 +84,7 @@ MenuActionListWidget::item:selected:active {
border-bottom-right-radius: 0px;
}
#completerListWidget::item {
#completerListWidget::item,
#comboListWidget::item {
margin-top: 4px;
padding-left: 10px;
padding-right: 10px;
border-radius: 5px;
border: none;
}
\ No newline at end of file
qfluentwidgets/_rc/qss/light/combo_box.qss
浏览文件 @
ec944da9
...
...
@@ -25,43 +25,3 @@ ComboBox:disabled {
border: 1px solid rgba(0, 0, 0, 0.06);
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
ComboBoxMenu>MenuActionListWidget {
border: 1px solid rgba(0, 0, 0, 0.1);
border-radius: 9px;
background-color: rgb(249, 249, 249);
outline: none;
font: 14px 'Segoe UI', 'Microsoft YaHei';
}
ComboBoxMenu>MenuActionListWidget::item {
margin-top: 4px;
padding-left: 10px;
padding-right: 10px;
border-radius: 5px;
border: none;
color: black;
}
ComboBoxMenu>MenuActionListWidget::item:disabled {
padding-left: 10px;
padding-right: 10px;
border-radius: 5px;
border: none;
color: black;
}
ComboBoxMenu>MenuActionListWidget::item:hover {
background-color: rgba(0, 0, 0, 9);
}
ComboBoxMenu>MenuActionListWidget::item:selected {
background-color: rgba(0, 0, 0, 7);
color: black;
}
ComboBoxMenu>MenuActionListWidget::item:selected:active {
background-color: rgba(0, 0, 0, 0.06);
color: rgba(0, 0, 0, 0.7);
}
\ No newline at end of file
qfluentwidgets/_rc/qss/light/menu.qss
浏览文件 @
ec944da9
...
...
@@ -47,8 +47,6 @@ MenuActionListWidget::item {
padding-right: 10px;
border-radius: 5px;
border: none;
margin-left: 6px;
margin-right: 6px;
color: black;
}
...
...
@@ -83,10 +81,7 @@ MenuActionListWidget::item:selected:active {
border-bottom-right-radius: 0px;
}
#completerListWidget::item {
#completerListWidget::item,
#comboListWidget::item {
margin-top: 4px;
padding-left: 10px;
padding-right: 10px;
border-radius: 5px;
border: none;
}
\ No newline at end of file
qfluentwidgets/_rc/resource.py
浏览文件 @
ec944da9
此差异已折叠。
点击以展开。
qfluentwidgets/components/navigation/pivot.py
浏览文件 @
ec944da9
...
...
@@ -164,7 +164,7 @@ class Pivot(QWidget):
widget
.
itemClicked
.
connect
(
onClick
)
self
.
items
[
routeKey
]
=
widget
self
.
hBoxLayout
.
insertWidget
(
index
,
widget
,
0
,
Qt
.
AlignLeft
)
self
.
hBoxLayout
.
insertWidget
(
index
,
widget
,
1
)
def
removeWidget
(
self
,
routeKey
:
str
):
""" remove widget
...
...
qfluentwidgets/components/navigation/segmented_widget.py
浏览文件 @
ec944da9
...
...
@@ -50,15 +50,3 @@ class SegmentedWidget(Pivot):
self
.
insertWidget
(
index
,
routeKey
,
item
,
onClick
)
return
item
def
insertWidget
(
self
,
index
:
int
,
routeKey
:
str
,
widget
:
PivotItem
,
onClick
=
None
):
if
routeKey
in
self
.
items
:
return
widget
.
setProperty
(
'routeKey'
,
routeKey
)
widget
.
itemClicked
.
connect
(
self
.
_onItemClicked
)
if
onClick
:
widget
.
itemClicked
.
connect
(
onClick
)
self
.
items
[
routeKey
]
=
widget
self
.
hBoxLayout
.
insertWidget
(
index
,
widget
,
1
)
qfluentwidgets/components/widgets/__init__.py
浏览文件 @
ec944da9
...
...
@@ -11,7 +11,8 @@ from .icon_widget import IconWidget
from
.label
import
(
PixmapLabel
,
CaptionLabel
,
StrongBodyLabel
,
BodyLabel
,
SubtitleLabel
,
TitleLabel
,
LargeTitleLabel
,
DisplayLabel
,
FluentLabelBase
)
from
.list_view
import
ListWidget
,
ListView
,
ListItemDelegate
from
.menu
import
DWMMenu
,
LineEditMenu
,
RoundMenu
,
MenuAnimationManager
,
MenuAnimationType
from
.menu
import
(
DWMMenu
,
LineEditMenu
,
RoundMenu
,
MenuAnimationManager
,
MenuAnimationType
,
IndicatorMenuItemDelegate
,
MenuItemDelegate
)
from
.info_bar
import
InfoBar
,
InfoBarIcon
,
InfoBarPosition
from
.scroll_area
import
SingleDirectionScrollArea
,
SmoothMode
,
SmoothScrollArea
,
ScrollArea
from
.slider
import
Slider
,
HollowHandleStyle
...
...
qfluentwidgets/components/widgets/combo_box.py
浏览文件 @
ec944da9
...
...
@@ -5,12 +5,12 @@ from PyQt5.QtCore import Qt, pyqtSignal, QRectF, QPoint, QObject, QEvent
from
PyQt5.QtGui
import
QPainter
,
QCursor
,
QIcon
from
PyQt5.QtWidgets
import
QAction
,
QPushButton
,
QStyledItemDelegate
,
QStyle
from
.menu
import
RoundMenu
,
Menu
ItemDelegate
,
MenuAnimationTyp
e
from
.menu
import
RoundMenu
,
Menu
AnimationType
,
IndicatorMenuItemDelegat
e
from
.line_edit
import
LineEdit
,
LineEditButton
from
...common.animation
import
TranslateYAnimation
from
...common.icon
import
FluentIconBase
,
isDarkTheme
from
...common.icon
import
FluentIcon
as
FIF
from
...common.style_sheet
import
FluentStyleSheet
,
themeColor
from
...common.style_sheet
import
FluentStyleSheet
class
ComboItem
:
...
...
@@ -412,24 +412,6 @@ class EditableComboBox(LineEdit, ComboBoxBase):
self
.
dropMenu
=
None
class
ComboMenuItemDelegate
(
MenuItemDelegate
):
""" Combo box drop menu item delegate """
def
paint
(
self
,
painter
:
QPainter
,
option
,
index
):
super
().
paint
(
painter
,
option
,
index
)
if
not
option
.
state
&
QStyle
.
State_Selected
:
return
painter
.
save
()
painter
.
setRenderHints
(
QPainter
.
Antialiasing
|
QPainter
.
SmoothPixmapTransform
|
QPainter
.
TextAntialiasing
)
painter
.
setPen
(
Qt
.
NoPen
)
painter
.
setBrush
(
themeColor
())
painter
.
drawRoundedRect
(
0
,
11
+
option
.
rect
.
y
(),
3
,
15
,
1.5
,
1.5
)
painter
.
restore
()
class
ComboBoxMenu
(
RoundMenu
):
""" Combo box menu """
...
...
@@ -439,9 +421,9 @@ class ComboBoxMenu(RoundMenu):
self
.
view
.
setViewportMargins
(
5
,
2
,
5
,
6
)
self
.
view
.
setVerticalScrollBarPolicy
(
Qt
.
ScrollBarAsNeeded
)
self
.
view
.
setItemDelegate
(
ComboMenuItemDelegate
())
self
.
view
.
setItemDelegate
(
IndicatorMenuItemDelegate
())
self
.
view
.
setObjectName
(
'comboListWidget'
)
FluentStyleSheet
.
COMBO_BOX
.
apply
(
self
)
self
.
setItemHeight
(
33
)
def
exec
(
self
,
pos
,
ani
=
True
,
aniType
=
MenuAnimationType
.
DROP_DOWN
):
...
...
qfluentwidgets/components/widgets/line_edit.py
浏览文件 @
ec944da9
...
...
@@ -3,14 +3,14 @@ from typing import List, Union
from
PyQt5.QtCore
import
QSize
,
Qt
,
QRectF
,
pyqtSignal
,
QPoint
,
QTimer
,
QEvent
,
QAbstractItemModel
from
PyQt5.QtGui
import
QPainter
,
QPainterPath
,
QIcon
,
QCursor
from
PyQt5.QtWidgets
import
(
QApplication
,
QAction
,
QHBoxLayout
,
QLineEdit
,
QToolButton
,
QTextEdit
,
QPlainTextEdit
,
QCompleter
)
QPlainTextEdit
,
QCompleter
,
QStyle
)
from
...common.style_sheet
import
FluentStyleSheet
,
themeColor
from
...common.icon
import
isDarkTheme
,
FluentIconBase
,
drawIcon
from
...common.icon
import
FluentIcon
as
FIF
from
...common.font
import
setFont
from
.menu
import
LineEditMenu
,
TextEditMenu
,
RoundMenu
,
MenuAnimationType
,
MenuActionListWidget
from
.menu
import
LineEditMenu
,
TextEditMenu
,
RoundMenu
,
MenuAnimationType
,
IndicatorMenuItemDelegate
from
.scroll_bar
import
SmoothScrollDelegate
...
...
@@ -164,17 +164,19 @@ class LineEdit(QLineEdit):
class
CompleterMenu
(
RoundMenu
):
""" Completer menu """
def
__init__
(
self
,
lineEdit
:
LineEdit
Menu
):
def
__init__
(
self
,
lineEdit
:
LineEdit
):
super
().
__init__
()
self
.
items
=
[]
self
.
lineEdit
=
lineEdit
self
.
installEventFilter
(
self
)
self
.
view
.
setViewportMargins
(
0
,
2
,
0
,
6
)
self
.
setItemHeight
(
33
)
self
.
view
.
setViewportMargins
(
6
,
2
,
6
,
6
)
self
.
view
.
setObjectName
(
'completerListWidget'
)
self
.
view
.
setItemDelegate
(
IndicatorMenuItemDelegate
())
self
.
view
.
setVerticalScrollBarPolicy
(
Qt
.
ScrollBarAsNeeded
)
self
.
installEventFilter
(
self
)
self
.
setItemHeight
(
33
)
def
setCompletion
(
self
,
model
:
QAbstractItemModel
):
""" set the completion model """
items
=
[]
...
...
@@ -195,10 +197,18 @@ class CompleterMenu(RoundMenu):
return
True
def
eventFilter
(
self
,
obj
,
e
:
QEvent
):
if
e
.
type
()
==
QEvent
.
KeyPress
:
self
.
lineEdit
.
event
(
e
)
if
e
.
key
()
==
Qt
.
Key_Escape
:
self
.
close
()
if
e
.
type
()
!=
QEvent
.
KeyPress
:
return
super
().
eventFilter
(
obj
,
e
)
# redirect input to line edit
self
.
lineEdit
.
event
(
e
)
self
.
view
.
event
(
e
)
if
e
.
key
()
==
Qt
.
Key_Escape
:
self
.
close
()
if
e
.
key
()
in
[
Qt
.
Key_Enter
,
Qt
.
Key_Return
]
and
self
.
view
.
currentRow
()
>=
0
:
self
.
lineEdit
.
setText
(
self
.
view
.
currentItem
().
text
())
self
.
close
()
return
super
().
eventFilter
(
obj
,
e
)
...
...
qfluentwidgets/components/widgets/menu.py
浏览文件 @
ec944da9
...
...
@@ -12,7 +12,7 @@ from PyQt5.QtWidgets import (QAction, QApplication, QMenu, QProxyStyle, QStyle,
from
...common.icon
import
FluentIcon
as
FIF
from
...common.icon
import
MenuIconEngine
,
Action
,
FluentIconBase
,
Icon
from
...common.style_sheet
import
FluentStyleSheet
from
...common.style_sheet
import
FluentStyleSheet
,
themeColor
from
...common.config
import
isDarkTheme
from
.scroll_bar
import
SmoothScrollDelegate
...
...
@@ -126,7 +126,7 @@ class MenuActionListWidget(QListWidget):
def
__init__
(
self
,
parent
=
None
):
super
().
__init__
(
parent
)
self
.
setViewportMargins
(
0
,
6
,
0
,
6
)
self
.
setViewportMargins
(
6
,
6
,
6
,
6
)
self
.
setTextElideMode
(
Qt
.
ElideNone
)
self
.
setDragEnabled
(
False
)
self
.
setMouseTracking
(
True
)
...
...
@@ -944,3 +944,22 @@ class TextEditMenu(EditMenu):
QTextCursor
.
Right
,
QTextCursor
.
KeepAnchor
,
self
.
selectionLength
)
super
().
_onItemClicked
(
item
)
class
IndicatorMenuItemDelegate
(
MenuItemDelegate
):
""" Menu item delegate with indicator """
def
paint
(
self
,
painter
:
QPainter
,
option
,
index
):
super
().
paint
(
painter
,
option
,
index
)
if
not
option
.
state
&
QStyle
.
State_Selected
:
return
painter
.
save
()
painter
.
setRenderHints
(
QPainter
.
Antialiasing
|
QPainter
.
SmoothPixmapTransform
|
QPainter
.
TextAntialiasing
)
painter
.
setPen
(
Qt
.
NoPen
)
painter
.
setBrush
(
themeColor
())
painter
.
drawRoundedRect
(
0
,
11
+
option
.
rect
.
y
(),
3
,
15
,
1.5
,
1.5
)
painter
.
restore
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录