Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
k54kdk
PyQt Fluent Widgets
提交
537109f3
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看板
提交
537109f3
编写于
6月 03, 2023
作者:
之一Yo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加直接更换 item 字体和前景色的功能
上级
0f48ed69
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
78164 addition
and
77596 deletion
+78164
-77596
examples/list_view/demo.py
examples/list_view/demo.py
+1
-1
qfluentwidgets/__init__.py
qfluentwidgets/__init__.py
+1
-1
qfluentwidgets/_rc/images/logo.png
qfluentwidgets/_rc/images/logo.png
+0
-0
qfluentwidgets/_rc/resource.py
qfluentwidgets/_rc/resource.py
+78053
-77569
qfluentwidgets/_rc/resource.qrc
qfluentwidgets/_rc/resource.qrc
+2
-0
qfluentwidgets/components/navigation/pivot.py
qfluentwidgets/components/navigation/pivot.py
+80
-8
qfluentwidgets/components/widgets/table_view.py
qfluentwidgets/components/widgets/table_view.py
+14
-9
qfluentwidgets/components/widgets/tree_view.py
qfluentwidgets/components/widgets/tree_view.py
+12
-7
setup.py
setup.py
+1
-1
未找到文件。
examples/list_view/demo.py
浏览文件 @
537109f3
...
...
@@ -33,7 +33,7 @@ class Demo(QWidget):
]
for
stand
in
stands
:
item
=
QListWidgetItem
(
stand
)
# item.setIcon(QIcon('
docs/source/_static
/logo.png'))
# item.setIcon(QIcon('
:/qfluentwidgets/images
/logo.png'))
# item.setCheckState(Qt.Unchecked)
self
.
listWidget
.
addItem
(
item
)
...
...
qfluentwidgets/__init__.py
浏览文件 @
537109f3
...
...
@@ -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.9.
2
"
__version__
=
"0.9.
3
"
from
.components
import
*
from
.common
import
*
...
...
qfluentwidgets/_rc/images/logo.png
0 → 100644
浏览文件 @
537109f3
7.4 KB
qfluentwidgets/_rc/resource.py
浏览文件 @
537109f3
此差异已折叠。
点击以展开。
qfluentwidgets/_rc/resource.qrc
浏览文件 @
537109f3
<RCC>
<qresource prefix="/qfluentwidgets">
<file>images/logo.png</file>
<file>images/color_dialog/Clear_black.svg</file>
<file>images/color_dialog/Clear_white.svg</file>
<file>images/color_dialog/HuePanel.png</file>
...
...
qfluentwidgets/components/navigation/pivot.py
浏览文件 @
537109f3
...
...
@@ -5,8 +5,10 @@ from PyQt5.QtCore import Qt, pyqtSignal
from
PyQt5.QtGui
import
QPainter
,
QFont
from
PyQt5.QtWidgets
import
QApplication
,
QPushButton
,
QWidget
,
QHBoxLayout
,
QSizePolicy
from
...common.router
import
qrouter
from
...common.style_sheet
import
themeColor
,
FluentStyleSheet
from
..widgets.scroll_area
import
SingleDirectionScrollArea
from
.navigation_panel
import
RouteKeyError
class
PivotItem
(
QPushButton
):
...
...
@@ -71,7 +73,7 @@ class Pivot(QWidget):
self
.
setSizePolicy
(
QSizePolicy
.
Minimum
,
QSizePolicy
.
Minimum
)
def
addItem
(
self
,
routeKey
:
str
,
text
:
str
,
onClick
):
def
addItem
(
self
,
routeKey
:
str
,
text
:
str
,
onClick
=
None
):
""" add item
Parameters
...
...
@@ -87,7 +89,23 @@ class Pivot(QWidget):
"""
return
self
.
insertItem
(
-
1
,
routeKey
,
text
,
onClick
)
def
insertItem
(
self
,
index
:
int
,
routeKey
:
str
,
text
:
str
,
onClick
):
def
addWidget
(
self
,
routeKey
:
str
,
widget
:
PivotItem
,
onClick
=
None
):
""" add widget
Parameters
----------
routeKey: str
the unique name of item
widget: PivotItem
navigation widget
onClick: callable
the slot connected to item clicked signal
"""
self
.
insertWidget
(
-
1
,
routeKey
,
widget
,
onClick
)
def
insertItem
(
self
,
index
:
int
,
routeKey
:
str
,
text
:
str
,
onClick
=
None
):
""" insert item
Parameters
...
...
@@ -108,14 +126,62 @@ class Pivot(QWidget):
return
item
=
PivotItem
(
text
,
self
)
item
.
setProperty
(
'routeKey'
,
routeKey
)
item
.
itemClicked
.
connect
(
self
.
_onItemClicked
)
item
.
itemClicked
.
connect
(
onClick
)
self
.
items
[
routeKey
]
=
item
self
.
hBoxLayout
.
insertWidget
(
index
,
item
,
0
,
Qt
.
AlignLeft
)
self
.
insertWidget
(
index
,
routeKey
,
item
,
onClick
)
return
item
def
insertWidget
(
self
,
index
:
int
,
routeKey
:
str
,
widget
:
PivotItem
,
onClick
=
None
):
""" insert item
Parameters
----------
index: int
insert position
routeKey: str
the unique name of item
widget: PivotItem
navigation widget
onClick: callable
the slot connected to item clicked signal
"""
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
,
0
,
Qt
.
AlignLeft
)
def
removeWidget
(
self
,
routeKey
:
str
):
""" remove widget
Parameters
----------
routeKey: str
the unique name of item
"""
if
routeKey
not
in
self
.
items
:
return
item
=
self
.
items
.
pop
(
routeKey
)
self
.
hBoxLayout
.
removeWidget
(
item
)
qrouter
.
remove
(
routeKey
)
item
.
deleteLater
()
def
clear
(
self
):
""" clear all navigation items """
for
k
,
w
in
self
.
items
.
items
():
self
.
hBoxLayout
.
removeWidget
(
w
)
qrouter
.
remove
(
k
)
w
.
deleteLater
()
self
.
items
.
clear
()
def
setCurrentItem
(
self
,
routeKey
:
str
):
""" set current selected item
...
...
@@ -141,3 +207,9 @@ class Pivot(QWidget):
def
_onItemClicked
(
self
):
item
=
self
.
sender
()
# type: PivotItem
self
.
setCurrentItem
(
item
.
property
(
'routeKey'
))
def
widget
(
self
,
routeKey
:
str
):
if
routeKey
not
in
self
.
items
:
raise
RouteKeyError
(
f
"`
{
routeKey
}
` is illegal."
)
return
self
.
items
[
routeKey
]
\ No newline at end of file
qfluentwidgets/components/widgets/table_view.py
浏览文件 @
537109f3
...
...
@@ -2,9 +2,9 @@
from
typing
import
List
,
Union
from
PyQt5.QtCore
import
Qt
,
QMargins
,
QModelIndex
,
QItemSelectionModel
from
PyQt5.QtGui
import
QPainter
,
QColor
,
QKeyEvent
,
QPalette
from
PyQt5.QtGui
import
QPainter
,
QColor
,
QKeyEvent
,
QPalette
,
QBrush
from
PyQt5.QtWidgets
import
(
QStyledItemDelegate
,
QApplication
,
QStyleOptionViewItem
,
QTableView
,
QTableWidget
,
QWidget
,
QTableWidgetItem
)
QTableView
,
QTableWidget
,
QWidget
,
QTableWidgetItem
,
QHeaderView
)
from
...common.font
import
getFont
from
...common.style_sheet
import
isDarkTheme
,
FluentStyleSheet
,
themeColor
...
...
@@ -79,13 +79,18 @@ class TableItemDelegate(QStyledItemDelegate):
def
initStyleOption
(
self
,
option
:
QStyleOptionViewItem
,
index
:
QModelIndex
):
super
().
initStyleOption
(
option
,
index
)
option
.
font
=
getFont
(
13
)
if
isDarkTheme
():
option
.
palette
.
setColor
(
QPalette
.
Text
,
Qt
.
white
)
option
.
palette
.
setColor
(
QPalette
.
HighlightedText
,
Qt
.
white
)
else
:
option
.
palette
.
setColor
(
QPalette
.
Text
,
Qt
.
black
)
option
.
palette
.
setColor
(
QPalette
.
HighlightedText
,
Qt
.
black
)
# font
option
.
font
=
index
.
data
(
Qt
.
FontRole
)
or
getFont
(
13
)
# text color
textColor
=
Qt
.
white
if
isDarkTheme
()
else
Qt
.
black
textBrush
=
index
.
data
(
Qt
.
TextColorRole
)
# type: QBrush
if
textBrush
is
not
None
:
textColor
=
textBrush
.
color
()
option
.
palette
.
setColor
(
QPalette
.
Text
,
textColor
)
option
.
palette
.
setColor
(
QPalette
.
HighlightedText
,
textColor
)
def
paint
(
self
,
painter
,
option
,
index
):
painter
.
save
()
...
...
qfluentwidgets/components/widgets/tree_view.py
浏览文件 @
537109f3
...
...
@@ -41,13 +41,18 @@ class TreeItemDelegate(QStyledItemDelegate):
def
initStyleOption
(
self
,
option
,
index
):
super
().
initStyleOption
(
option
,
index
)
option
.
font
=
getFont
(
13
)
if
isDarkTheme
():
option
.
palette
.
setColor
(
QPalette
.
Text
,
Qt
.
white
)
option
.
palette
.
setColor
(
QPalette
.
HighlightedText
,
Qt
.
white
)
else
:
option
.
palette
.
setColor
(
QPalette
.
Text
,
Qt
.
black
)
option
.
palette
.
setColor
(
QPalette
.
HighlightedText
,
Qt
.
black
)
# font
option
.
font
=
index
.
data
(
Qt
.
FontRole
)
or
getFont
(
13
)
# text color
textColor
=
Qt
.
white
if
isDarkTheme
()
else
Qt
.
black
textBrush
=
index
.
data
(
Qt
.
TextColorRole
)
if
textBrush
is
not
None
:
textColor
=
textBrush
.
color
()
option
.
palette
.
setColor
(
QPalette
.
Text
,
textColor
)
option
.
palette
.
setColor
(
QPalette
.
HighlightedText
,
textColor
)
class
TreeViewBase
:
...
...
setup.py
浏览文件 @
537109f3
...
...
@@ -6,7 +6,7 @@ with open('README.md', encoding='utf-8') as f:
setuptools
.
setup
(
name
=
"PyQt-Fluent-Widgets"
,
version
=
"0.9.
2
"
,
version
=
"0.9.
3
"
,
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录