Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
15a9d19c
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看板
提交
15a9d19c
编写于
5月 14, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #200
上级
b040d53f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
14 deletion
+29
-14
examples/line_edit/demo.py
examples/line_edit/demo.py
+11
-10
plugins/text_plugin.py
plugins/text_plugin.py
+14
-1
qfluentwidgets/components/widgets/line_edit.py
qfluentwidgets/components/widgets/line_edit.py
+4
-3
未找到文件。
examples/line_edit/demo.py
浏览文件 @
15a9d19c
# coding:utf-8
import
sys
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtWidgets
import
QApplication
,
QWidget
from
PyQt5.QtWidgets
import
QApplication
,
QWidget
,
QHBoxLayout
from
qfluentwidgets
import
LineEdit
,
PushButton
,
Text
Edit
from
qfluentwidgets
import
LineEdit
,
PushButton
,
SearchLine
Edit
class
Demo
(
QWidget
):
def
__init__
(
self
):
super
().
__init__
()
self
.
lineEdit
=
LineEdi
t
(
self
)
self
.
button
=
PushButton
(
'按钮'
,
self
)
self
.
textEdit
=
TextEdit
(
self
)
self
.
hBoxLayout
=
QHBoxLayou
t
(
self
)
self
.
lineEdit
=
SearchLineEdit
(
self
)
self
.
button
=
PushButton
(
'Search'
,
self
)
self
.
resize
(
500
,
5
00
)
self
.
textEdit
.
move
(
110
,
200
)
self
.
lineEdit
.
move
(
110
,
50
)
self
.
button
.
move
(
320
,
52
)
self
.
resize
(
400
,
4
00
)
self
.
hBoxLayout
.
setAlignment
(
Qt
.
AlignCenter
)
self
.
hBoxLayout
.
addWidget
(
self
.
lineEdit
,
0
,
Qt
.
AlignCenter
)
self
.
hBoxLayout
.
addWidget
(
self
.
button
,
0
,
Qt
.
AlignCenter
)
self
.
lineEdit
.
res
ize
(
200
,
33
)
self
.
lineEdit
.
setFixedS
ize
(
200
,
33
)
self
.
lineEdit
.
setClearButtonEnabled
(
True
)
self
.
lineEdit
.
setPlaceholderText
(
'Search icon'
)
if
__name__
==
'__main__'
:
...
...
plugins/text_plugin.py
浏览文件 @
15a9d19c
...
...
@@ -2,7 +2,7 @@
from
PyQt5.QtCore
import
Qt
from
PyQt5.QtDesigner
import
QPyDesignerCustomWidgetPlugin
from
qfluentwidgets
import
SpinBox
,
DoubleSpinBox
,
TextEdit
,
TimeEdit
,
DateTimeEdit
,
LineEdit
,
PlainTextEdit
,
DateEdit
from
qfluentwidgets
import
SpinBox
,
DoubleSpinBox
,
TextEdit
,
TimeEdit
,
DateTimeEdit
,
LineEdit
,
PlainTextEdit
,
DateEdit
,
SearchLineEdit
from
plugin_base
import
PluginBase
...
...
@@ -26,6 +26,19 @@ class LineEditPlugin(TextPlugin, QPyDesignerCustomWidgetPlugin):
return
"LineEdit"
class
SearchLineEditPlugin
(
TextPlugin
,
QPyDesignerCustomWidgetPlugin
):
""" Search line edit plugin """
def
createWidget
(
self
,
parent
):
return
SearchLineEdit
(
parent
)
def
icon
(
self
):
return
super
().
icon
(
"IconElement"
)
def
name
(
self
):
return
"SearchLineEdit"
class
TextEditPlugin
(
TextPlugin
,
QPyDesignerCustomWidgetPlugin
):
""" Text edit plugin """
...
...
qfluentwidgets/components/widgets/line_edit.py
浏览文件 @
15a9d19c
...
...
@@ -111,12 +111,13 @@ class LineEdit(QLineEdit):
painter
.
setRenderHints
(
QPainter
.
Antialiasing
)
painter
.
setPen
(
Qt
.
NoPen
)
m
=
self
.
contentsMargins
()
path
=
QPainterPath
()
w
,
h
=
self
.
width
(),
self
.
height
()
path
.
addRoundedRect
(
QRectF
(
0
,
h
-
10
,
w
,
10
),
5
,
5
)
w
,
h
=
self
.
width
()
-
m
.
left
()
-
m
.
right
()
,
self
.
height
()
path
.
addRoundedRect
(
QRectF
(
m
.
left
()
,
h
-
10
,
w
,
10
),
5
,
5
)
rectPath
=
QPainterPath
()
rectPath
.
addRect
(
0
,
h
-
10
,
w
,
8
)
rectPath
.
addRect
(
m
.
left
()
,
h
-
10
,
w
,
8
)
path
=
path
.
subtracted
(
rectPath
)
painter
.
fillPath
(
path
,
themeColor
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录