Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
fd44d199
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看板
提交
fd44d199
编写于
6月 01, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #246
上级
9707786e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
35 deletion
+15
-35
qfluentwidgets/components/widgets/list_view.py
qfluentwidgets/components/widgets/list_view.py
+6
-16
qfluentwidgets/components/widgets/scroll_bar.py
qfluentwidgets/components/widgets/scroll_bar.py
+1
-1
qfluentwidgets/components/widgets/table_view.py
qfluentwidgets/components/widgets/table_view.py
+8
-18
未找到文件。
qfluentwidgets/components/widgets/list_view.py
浏览文件 @
fd44d199
...
@@ -64,20 +64,14 @@ class ListBase:
...
@@ -64,20 +64,14 @@ class ListBase:
def
keyPressEvent
(
self
,
e
):
def
keyPressEvent
(
self
,
e
):
QListView
.
keyPressEvent
(
self
,
e
)
QListView
.
keyPressEvent
(
self
,
e
)
self
.
_updateSelectedRows
()
self
.
updateSelectedRows
()
def
mousePressEvent
(
self
,
e
):
if
e
.
button
()
==
Qt
.
LeftButton
:
QListView
.
mousePressEvent
(
self
,
e
)
else
:
self
.
_setPressedRow
(
self
.
indexAt
(
e
.
pos
()).
row
())
def
mouseReleaseEvent
(
self
,
e
):
def
mouseReleaseEvent
(
self
,
e
):
QListView
.
mouseReleaseEvent
(
self
,
e
)
QListView
.
mouseReleaseEvent
(
self
,
e
)
row
=
self
.
indexAt
(
e
.
pos
()).
row
()
row
=
self
.
indexAt
(
e
.
pos
()).
row
()
if
row
>=
0
and
e
.
button
()
!=
Qt
.
RightButton
:
if
row
>=
0
and
e
.
button
()
!=
Qt
.
RightButton
:
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
else
:
else
:
self
.
_setPressedRow
(
-
1
)
self
.
_setPressedRow
(
-
1
)
...
@@ -85,19 +79,15 @@ class ListBase:
...
@@ -85,19 +79,15 @@ class ListBase:
self
.
delegate
=
delegate
self
.
delegate
=
delegate
super
().
setItemDelegate
(
delegate
)
super
().
setItemDelegate
(
delegate
)
def
setSelection
(
self
,
rect
,
command
):
QListView
.
setSelection
(
self
,
rect
,
command
)
self
.
_updateSelectedRows
()
def
clearSelection
(
self
):
def
clearSelection
(
self
):
QListView
.
clearSelection
(
self
)
QListView
.
clearSelection
(
self
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
def
setCurrentIndex
(
self
,
index
:
QModelIndex
):
def
setCurrentIndex
(
self
,
index
:
QModelIndex
):
QListView
.
setCurrentIndex
(
self
,
index
)
QListView
.
setCurrentIndex
(
self
,
index
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
def
_
updateSelectedRows
(
self
):
def
updateSelectedRows
(
self
):
self
.
_setSelectedRows
(
self
.
selectedIndexes
())
self
.
_setSelectedRows
(
self
.
selectedIndexes
())
...
@@ -116,7 +106,7 @@ class ListWidget(ListBase, QListWidget):
...
@@ -116,7 +106,7 @@ class ListWidget(ListBase, QListWidget):
else
:
else
:
super
().
setCurrentRow
(
row
,
command
)
super
().
setCurrentRow
(
row
,
command
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
class
ListView
(
ListBase
,
QListView
):
class
ListView
(
ListBase
,
QListView
):
...
...
qfluentwidgets/components/widgets/scroll_bar.py
浏览文件 @
fd44d199
...
@@ -318,7 +318,7 @@ class ScrollBar(QWidget):
...
@@ -318,7 +318,7 @@ class ScrollBar(QWidget):
dv
=
e
.
pos
().
x
()
-
self
.
_pressedPos
.
x
()
dv
=
e
.
pos
().
x
()
-
self
.
_pressedPos
.
x
()
# don't use `self.setValue()`, because it could be reimplemented
# don't use `self.setValue()`, because it could be reimplemented
dv
=
dv
/
self
.
_slideLength
()
*
(
self
.
maximum
()
-
self
.
minimum
(
))
dv
=
int
(
dv
/
self
.
_slideLength
()
*
(
self
.
maximum
()
-
self
.
minimum
()
))
ScrollBar
.
setValue
(
self
,
self
.
value
()
+
dv
)
ScrollBar
.
setValue
(
self
,
self
.
value
()
+
dv
)
self
.
_pressedPos
=
e
.
pos
()
self
.
_pressedPos
=
e
.
pos
()
...
...
qfluentwidgets/components/widgets/table_view.py
浏览文件 @
fd44d199
...
@@ -184,20 +184,14 @@ class TableBase:
...
@@ -184,20 +184,14 @@ class TableBase:
def
keyPressEvent
(
self
,
e
:
QKeyEvent
):
def
keyPressEvent
(
self
,
e
:
QKeyEvent
):
QTableView
.
keyPressEvent
(
self
,
e
)
QTableView
.
keyPressEvent
(
self
,
e
)
self
.
_updateSelectedRows
()
self
.
updateSelectedRows
()
def
mousePressEvent
(
self
,
e
:
QKeyEvent
):
if
e
.
button
()
==
Qt
.
LeftButton
:
QTableView
.
mousePressEvent
(
self
,
e
)
else
:
self
.
_setPressedRow
(
self
.
indexAt
(
e
.
pos
()).
row
())
def
mouseReleaseEvent
(
self
,
e
):
def
mouseReleaseEvent
(
self
,
e
):
QTableView
.
mouseReleaseEvent
(
self
,
e
)
QTableView
.
mouseReleaseEvent
(
self
,
e
)
row
=
self
.
indexAt
(
e
.
pos
()).
row
()
row
=
self
.
indexAt
(
e
.
pos
()).
row
()
if
row
>=
0
and
e
.
button
()
!=
Qt
.
RightButton
:
if
row
>=
0
and
e
.
button
()
!=
Qt
.
RightButton
:
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
else
:
else
:
self
.
_setPressedRow
(
-
1
)
self
.
_setPressedRow
(
-
1
)
...
@@ -207,25 +201,21 @@ class TableBase:
...
@@ -207,25 +201,21 @@ class TableBase:
def
selectAll
(
self
):
def
selectAll
(
self
):
QTableView
.
selectAll
(
self
)
QTableView
.
selectAll
(
self
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
def
selectRow
(
self
,
row
:
int
):
def
selectRow
(
self
,
row
:
int
):
QTableView
.
selectRow
(
self
,
row
)
QTableView
.
selectRow
(
self
,
row
)
self
.
_updateSelectedRows
()
self
.
updateSelectedRows
()
def
setSelection
(
self
,
rect
,
command
):
QTableView
.
setSelection
(
self
,
rect
,
command
)
self
.
_updateSelectedRows
()
def
clearSelection
(
self
):
def
clearSelection
(
self
):
QTableView
.
clearSelection
(
self
)
QTableView
.
clearSelection
(
self
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
def
setCurrentIndex
(
self
,
index
:
QModelIndex
):
def
setCurrentIndex
(
self
,
index
:
QModelIndex
):
QTableView
.
setCurrentIndex
(
self
,
index
)
QTableView
.
setCurrentIndex
(
self
,
index
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
def
_
updateSelectedRows
(
self
):
def
updateSelectedRows
(
self
):
self
.
_setSelectedRows
(
self
.
selectedIndexes
())
self
.
_setSelectedRows
(
self
.
selectedIndexes
())
...
@@ -244,7 +234,7 @@ class TableWidget(TableBase, QTableWidget):
...
@@ -244,7 +234,7 @@ class TableWidget(TableBase, QTableWidget):
else
:
else
:
super
().
setCurrentItem
(
item
,
command
)
super
().
setCurrentItem
(
item
,
command
)
self
.
_
updateSelectedRows
()
self
.
updateSelectedRows
()
class
TableView
(
TableBase
,
QTableView
):
class
TableView
(
TableBase
,
QTableView
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录