Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
ed0c04a9
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看板
提交
ed0c04a9
编写于
4月 02, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #67
上级
35d14c98
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
39 addition
and
13 deletion
+39
-13
examples/scroll_area/demo.py
examples/scroll_area/demo.py
+3
-3
examples/scroll_area/resource/demo.qss
examples/scroll_area/resource/demo.qss
+14
-1
qfluentwidgets/__init__.py
qfluentwidgets/__init__.py
+1
-1
qfluentwidgets/components/widgets/scroll_area.py
qfluentwidgets/components/widgets/scroll_area.py
+20
-7
setup.py
setup.py
+1
-1
未找到文件。
examples/scroll_area/demo.py
浏览文件 @
ed0c04a9
...
...
@@ -2,15 +2,15 @@
import
sys
from
PyQt5.QtCore
import
QEasingCurve
,
Qt
from
PyQt5.QtGui
import
QPixmap
from
PyQt5.QtWidgets
import
QApplication
,
QLabel
from
qfluentwidgets
import
SmoothScrollArea
from
PyQt5.QtWidgets
import
QApplication
from
qfluentwidgets
import
SmoothScrollArea
,
PixmapLabel
class
Demo
(
SmoothScrollArea
):
def
__init__
(
self
):
super
().
__init__
()
self
.
label
=
Q
Label
(
self
)
self
.
label
=
Pixmap
Label
(
self
)
self
.
label
.
setPixmap
(
QPixmap
(
"resource/shoko.jpg"
))
# customize scroll animation
...
...
examples/scroll_area/resource/demo.qss
浏览文件 @
ed0c04a9
QScrollBar {
QScrollBar
:vertical
{
background: transparent;
width: 5px;
padding-right: 2px;
}
QScrollBar:horizontal {
background: transparent;
height: 5px;
padding-bottom: 2px;
}
/*隐藏上箭头*/
QScrollBar::sub-line {
background: transparent;
...
...
@@ -18,9 +24,16 @@ QScrollBar::handle {
background: rgb(122, 122, 122);
border: 2px solid rgb(128, 128, 128);
border-radius: 1px;
}
QScrollBar::handle:vertical {
min-height: 40px;
}
QScrollBar::handle:horizontal {
min-width: 40px;
}
QScrollBar::add-page,
QScrollBar::sub-page {
background: none;
...
...
qfluentwidgets/__init__.py
浏览文件 @
ed0c04a9
...
...
@@ -12,7 +12,7 @@ Examples are available at https://github.com/zhiyiYo/PyQt-Fluent-Widgets/tree/ma
:license: GPLv3, see LICENSE for more details.
"""
__version__
=
"0.5.
3
"
__version__
=
"0.5.
4
"
from
.components
import
*
from
.common
import
*
...
...
qfluentwidgets/components/widgets/scroll_area.py
浏览文件 @
ed0c04a9
...
...
@@ -34,6 +34,7 @@ class ScrollArea(QScrollArea):
def
wheelEvent
(
self
,
e
):
self
.
smoothScroll
.
wheelEvent
(
e
)
class
SmoothScrollBar
(
QScrollBar
):
""" Smooth scroll bar """
...
...
@@ -46,9 +47,11 @@ class SmoothScrollBar(QScrollBar):
self
.
ani
.
setPropertyName
(
b
"value"
)
self
.
ani
.
setEasingCurve
(
QEasingCurve
.
OutCubic
)
self
.
ani
.
setDuration
(
500
)
self
.
__value
=
self
.
value
()
self
.
ani
.
finished
.
connect
(
self
.
scrollFinished
)
def
setValue
(
self
,
value
:
int
):
def
setValue
(
self
,
value
):
if
value
==
self
.
value
():
return
...
...
@@ -60,27 +63,37 @@ class SmoothScrollBar(QScrollBar):
self
.
ani
.
setEndValue
(
value
)
self
.
ani
.
start
()
def
scrollValue
(
self
,
value
:
int
):
def
scrollValue
(
self
,
value
):
""" scroll the specified distance """
value
+=
self
.
value
()
self
.
scrollTo
(
value
)
self
.
__value
+=
value
self
.
__value
=
max
(
self
.
minimum
(),
self
.
__value
)
self
.
__value
=
min
(
self
.
maximum
(),
self
.
__value
)
self
.
setValue
(
self
.
__value
)
def
scrollTo
(
self
,
value
:
int
):
def
scrollTo
(
self
,
value
):
""" scroll to the specified position """
value
=
min
(
self
.
maximum
(),
max
(
self
.
minimum
(),
value
))
self
.
setValue
(
value
)
self
.
__value
=
value
self
.
__value
=
max
(
self
.
minimum
(),
self
.
__value
)
self
.
__value
=
min
(
self
.
maximum
(),
self
.
__value
)
self
.
setValue
(
self
.
__value
)
def
resetValue
(
self
,
value
):
self
.
__value
=
value
def
mousePressEvent
(
self
,
e
):
self
.
ani
.
stop
()
super
().
mousePressEvent
(
e
)
self
.
__value
=
self
.
value
()
def
mouseReleaseEvent
(
self
,
e
):
self
.
ani
.
stop
()
super
().
mouseReleaseEvent
(
e
)
self
.
__value
=
self
.
value
()
def
mouseMoveEvent
(
self
,
e
):
self
.
ani
.
stop
()
super
().
mouseMoveEvent
(
e
)
self
.
__value
=
self
.
value
()
class
SmoothScrollArea
(
QScrollArea
):
...
...
setup.py
浏览文件 @
ed0c04a9
...
...
@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
setuptools
.
setup
(
name
=
"PyQt-Fluent-Widgets"
,
version
=
"0.5.
3
"
,
version
=
"0.5.
4
"
,
keywords
=
"pyqt fluent widgets"
,
author
=
"zhiyiYo"
,
author_email
=
"shokokawaii@outlook.com"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录