Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
3f27ee65
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看板
提交
3f27ee65
编写于
2月 21, 2022
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复流式布局的问题
上级
cb4d6803
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
6 deletion
+5
-6
widgets/flow_layout/flow_layout.py
widgets/flow_layout/flow_layout.py
+5
-6
未找到文件。
widgets/flow_layout/flow_layout.py
浏览文件 @
3f27ee65
...
@@ -4,13 +4,12 @@ from PyQt5.QtWidgets import QLayout
...
@@ -4,13 +4,12 @@ from PyQt5.QtWidgets import QLayout
class
FlowLayout
(
QLayout
):
class
FlowLayout
(
QLayout
):
def
__init__
(
self
,
parent
=
None
):
def
__init__
(
self
,
parent
=
None
):
super
().
__init__
(
parent
)
super
().
__init__
(
parent
)
self
.
__items
=
[]
self
.
__items
=
[]
self
.
__verticalSpacing
=
10
self
.
__verticalSpacing
=
10
self
.
__horizontalSpacing
=
10
self
.
__horizontalSpacing
=
10
self
.
__margins
=
QMargins
(
0
,
0
,
0
,
0
)
super
().
setContentsMargins
(
self
.
__margins
)
def
addItem
(
self
,
item
):
def
addItem
(
self
,
item
):
self
.
__items
.
append
(
item
)
self
.
__items
.
append
(
item
)
...
@@ -43,11 +42,11 @@ class FlowLayout(QLayout):
...
@@ -43,11 +42,11 @@ class FlowLayout(QLayout):
def
heightForWidth
(
self
,
width
:
int
):
def
heightForWidth
(
self
,
width
:
int
):
""" 根据宽度计算最小高度 """
""" 根据宽度计算最小高度 """
return
self
.
__do
_l
ayout
(
QRect
(
0
,
0
,
width
,
0
),
False
)
return
self
.
__do
L
ayout
(
QRect
(
0
,
0
,
width
,
0
),
False
)
def
setGeometry
(
self
,
rect
:
QRect
):
def
setGeometry
(
self
,
rect
:
QRect
):
super
().
setGeometry
(
rect
)
super
().
setGeometry
(
rect
)
self
.
__do
_l
ayout
(
rect
,
True
)
self
.
__do
L
ayout
(
rect
,
True
)
def
sizeHint
(
self
):
def
sizeHint
(
self
):
return
self
.
minimumSize
()
return
self
.
minimumSize
()
...
@@ -58,7 +57,7 @@ class FlowLayout(QLayout):
...
@@ -58,7 +57,7 @@ class FlowLayout(QLayout):
for
item
in
self
.
__items
:
for
item
in
self
.
__items
:
size
=
size
.
expandedTo
(
item
.
minimumSize
())
size
=
size
.
expandedTo
(
item
.
minimumSize
())
m
=
self
.
__margins
m
=
self
.
contentsMargins
()
size
+=
QSize
(
m
.
left
()
+
m
.
right
(),
m
.
top
()
+
m
.
bottom
())
size
+=
QSize
(
m
.
left
()
+
m
.
right
(),
m
.
top
()
+
m
.
bottom
())
return
size
return
size
...
@@ -79,7 +78,7 @@ class FlowLayout(QLayout):
...
@@ -79,7 +78,7 @@ class FlowLayout(QLayout):
""" 返回水平方向间距 """
""" 返回水平方向间距 """
return
self
.
__horizontalSpacing
return
self
.
__horizontalSpacing
def
__do
_l
ayout
(
self
,
rect
:
QRect
,
move
:
bool
):
def
__do
L
ayout
(
self
,
rect
:
QRect
,
move
:
bool
):
""" 根据大小调整小部件位置 """
""" 根据大小调整小部件位置 """
margin
=
self
.
contentsMargins
()
margin
=
self
.
contentsMargins
()
x
=
rect
.
x
()
+
margin
.
left
()
x
=
rect
.
x
()
+
margin
.
left
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录