zhiyiyo / pyqt-fluent-widgets Goto Github PK
View Code? Open in Web Editor NEWA fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
Home Page: https://qfluentwidgets.com
License: GNU General Public License v3.0
A fluent design widgets library based on C++ Qt/PyQt/PySide. Make Qt Great Again.
Home Page: https://qfluentwidgets.com
License: GNU General Public License v3.0
能不能整一版中文的"README.md"和"help document"
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 16 16">
<path d="M10.55 2.532a2.25 2.25 0 0 1 2.9 0l6.75 5.692c.507.428.8 1.057.8 1.72v9.803a1.75 1.75 0 0 1-1.75 1.75h-3.5a1.75 1.75 0 0 1-1.75-1.75v-5.5a.25.25 0 0 0-.25-.25h-3.5a.25.25 0 0 0-.25.25v5.5a1.75 1.75 0 0 1-1.75 1.75h-3.5A1.75 1.75 0 0 1 3 19.747V9.944c0-.663.293-1.292.8-1.72l6.75-5.692Zm1.933 1.147a.75.75 0 0 0-.966 0L4.767 9.37a.75.75 0 0 0-.267.573v9.803c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-5.5c0-.967.784-1.75 1.75-1.75h3.5c.966 0 1.75.783 1.75 1.75v5.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25V9.944a.75.75 0 0 0-.267-.573l-6.75-5.692Z" fill="#ffffff" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16" viewBox="0 0 16 16">
<path
d="M6.049 7.984a.75.75 0 0 1 .967-.435L12 9.439l4.984-1.89a.75.75 0 1 1 .532 1.402L12.75 10.76v5.491a.75.75 0 0 1-1.5 0v-5.49L6.484 8.95a.75.75 0 0 1-.435-.967Z"
fill="#DDE6E8" />
<path
d="M10.591 2.512a3.75 3.75 0 0 1 2.818 0l7.498 3.04A1.75 1.75 0 0 1 22 7.174v9.652a1.75 1.75 0 0 1-1.093 1.622l-7.498 3.04a3.75 3.75 0 0 1-2.818 0l-7.498-3.04A1.75 1.75 0 0 1 2 16.826V7.175a1.75 1.75 0 0 1 1.093-1.622l7.498-3.04Zm2.254 1.39a2.25 2.25 0 0 0-1.69 0l-7.499 3.04a.25.25 0 0 0-.156.232v9.652a.25.25 0 0 0 .156.232l7.499 3.04a2.25 2.25 0 0 0 1.69 0l7.499-3.04a.25.25 0 0 0 .156-.232V7.175a.25.25 0 0 0-.156-.232l-7.499-3.04Z"
fill="#DDE6E8" />
</svg>
windows11, pyqt6= 6.4.2
File ".\PyQt-Fluent-Widgets-PyQt6\examples\gallery\app\components\avatar_widget.py", line 38, in paintEvent painter.setPen(Qt.white if isDarkTheme() else Qt.black)
AttributeError: type object 'Qt' has no attribute 'black'
将 painter.setPen(Qt.white if isDarkTheme() else Qt.black)
修改为 painter.setPen(Qt.GlobalColor.white if isDarkTheme() else Qt.GlobalColor.black)
File ".\PyQt-Fluent-Widgets-PyQt6\examples\gallery\app\components\avatar_widget.py", line 42, in paintEvent
painter.drawText(QRect(44, 0, 255, 36), Qt.AlignVCenter, 'zhiyiYo')
AttributeError: type object 'Qt' has no attribute 'AlignVCenter'
将 painter.drawText(QRect(44, 0, 255, 36), Qt.AlignVCenter, 'zhiyiYo')
修改为 painter.drawText(QRect(44, 0, 255, 36), Qt.AlignmentFlag.AlignVCenter, 'zhiyiYo')
@Ephemeralwanning
可以在qtdesigner用的,比如lineEdit,你在qtdesigner正常添加LineEdit控件,然后右键,把它提升为 LineEdit (作者写的组建名),头文件就写 qfluentwidgets .这样你的ui文件生成py文件的时候,会自动import这个组件
尝试以上方法结果报错
报错信息:
Traceback (most recent call last):
File "d:/apkTS/code/github/test/demo.py", line 435, in <module>
w = Window()
File "d:/apkTS/code/github/test/demo.py", line 312, in __init__
self.thumbInterface = MainWindow()
File "d:/apkTS/code/github/test/demo.py", line 69, in __init__
self.setupUi(self)
File "d:\apkTS\code\github\test\Mai_UI\thumbs.py", line 153, in setupUi
self.lineEdit_3 = LineEdit(self.groupBox_2)
File "d:\apkTS\code\github\test\qfluentwidgets\components\widgets\line_edit.py", line 14, in __init__
super().__init__(contents, parent)
TypeError: arguments did not match any overloaded call:
QLineEdit(parent: QWidget = None): too many arguments
QLineEdit(str, parent: QWidget = None): argument 1 has unexpected type 'QGroupBox'
dialog.qss只写了QPushButton#yesButton的样式,#cancelButton没指定,默认用的QPushButton,但是我程序本身的qss也有定义了QPushButton,导致覆盖了cancelButton的样式
(看视频)
就是……我也想实现一个这样的背景特效
基本都使用Qml,对PyQt很不了解,所以求教
source-over
混合之前,我在尝试实现时用了繁琐的层和同步才能部分解决问题,依然实现不了任意混合和多层混合Color
混合模式和背景混合预处理,一层以 Luminosity
预处理,一层噪声图像,最终以 source-over
叠加,AcrylicLabel中可以在哪里找到一些示例实现?同上原因,我不得不把高斯模糊和两种混合预处理的着色器写在同一个片段着色器中,增加了耦合而且使得维护有一些障碍。目前我的做法是用listwidget配合stackedwidget,首先在qlistwidget设置好图标和文字,然后给定一个宽度,比如200px,然后切换的时候,把这个宽度设置为50px,就有类似缩回去的动画;这时候宽度只够显示图标,把滚动条隐藏,就有视频中的效果,但是这个做法比较奇葩,希望作者有更好的实现方法。
假设一个场景,我现在想要把一个老项目中的button全部转换成 qfluentwidgets
中的 PushButton
,请问我需要怎么做?其他类型控件也同理。看了一下代码实现,好像暂时没有提供组件快速转换的功能,能否提供一个快速转换的方式,让开发者可以用最小的成本进行UI主题的转换呢?
Hello. Thanks for this project.
Is there a way to use it for QML?
I would like to write fluent style ui but I'm using QML not Qt widgets.
Thanks.
我在使用Python 3.11 64Bit 运行Demo的时候有很多问题,推荐使用什么版本运行这个库?
Describe the bug
有多级子菜单时,RoundMenu点击最后一一级的菜单的action时,无法正常关闭所有菜单
Environment
To Reproduce
Steps to reproduce the behavior(you can use gif to demonstrate the problem):
Code
非复现代码,我在修改了RounMenu的_closeParentMenu为递归close后恢复正常
def _closeParentMenu(self):
menu = self
while menu.parentMenu:
parent = menu.parentMenu
menu.close()
menu = parent
menu.close()
Expected behavior
正常关闭所有菜单
您好。无意中看到您这个库。使用了一下。在 Windows 10 上无边框使用系统的 DWM 阴影。如果窗体想要开启圆角使用 QSS 。则会出现一个白色的一层窗体。如果使用 Qt 的 API 设置为透明背景则 DWM 阴影消失。这二者互斥。有什么解决方法么?
提示内容稍多点就可以发现问题:
修改了下demo的代码,加了两个按钮,并且增加了提示内容的长度。
按钮1,无法很好的躲避屏幕
按钮2,不停闪烁
按钮3和4,来回切换时会发现 enterEvent 会被触发两次,第一次size是乱的,第二次才是正确的。
def __init__(self):
super().__init__()
self.hBox = QHBoxLayout(self)
self.button1 = QPushButton('キラキ\nラ', self)
self.button2 = QPushButton('食べた\n愛', self)
self.button3 = QPushButton('asd\nfasdf', self)
self.button4 = QPushButton('asd\nfasdf', self)
self._toolTip = ToolTip(parent=self)
# self._toolTip.setDarkTheme(True)
self.button1.setToolTip('aiko - キラキラ ✨'*90)
self.button2.setToolTip('aiko - 食べた愛 🥰\n'*90)
self.button3.setToolTip('aiko - キラキラ ✨'*10)
self.button4.setToolTip('aiko - 食べた愛 🥰\n'*10)
self.button1.setToolTipDuration(1000)
self.button2.setToolTipDuration(5000)
self.button3.setToolTipDuration(1000)
self.button4.setToolTipDuration(5000)
self.button1.installEventFilter(self)
self.button2.installEventFilter(self)
self.button3.installEventFilter(self)
self.button4.installEventFilter(self)
self.hBox.setContentsMargins(30, 30, 30, 30)
self.hBox.setSpacing(20)
self.hBox.addWidget(self.button1)
self.hBox.addWidget(self.button2)
self.hBox.addWidget(self.button3)
self.hBox.addWidget(self.button4)
self.resize(600, 300)
self._toolTip.hide()
self.setStyleSheet(self.DEMO_STYLE_SHEET)
从某个版本开始,切换 浅色到自动主题的时候会出错
ICON太少了,根本不够用!!
应该是PyQt-Fluent-Widgets的问题,我在https://fluenticons.co/?ref=microns.io、https://www.iconfont.cn/ 下载的许多图标都在错位(我使用的所有图标向有偏移),不知道是否与viewBox(viewBox="0 0 16 16" )相关?
我又来了。。
这个库现在算是比较完善了,如果有个日历控件就更好了,自带的实在是太难看了,也不好美化,写了半天qss还是好丑。。。
估计只能像combox那样直接自己画一个了
Describe the bug
更改选项框内容后程序崩溃
Environment
To Reproduce
1.更改任何一个选项框的内容
2.见错误
3.程序崩溃
4.重启程序后选项框的选项是生效的(比如变成深色模式)
Code
Traceback (most recent call last):
File "D:\WinDownload\examples\settings\setting_interface.py", line 260, in __showRestartTooltip
ToastToolTip.warn(
^^^^^^^^^^^^^^^^^
AttributeError: type object 'ToastToolTip' has no attribute 'warn'
请修复此BUG
self.navigationInterface.addItem(
routeKey=self.promptInterface.objectName(),
icon=QPixmap(icon_dir + "prompt.png"),
text="Prompt",
onClick=lambda: self.switchTo(self.promptInterface),
)
File "***\lib\site-packages\qfluentwidgets\common\icon.py", line 89, in drawIcon
painter.drawPixmap(rect, image)
TypeError: arguments did not match any overloaded call:
drawPixmap(self, QRectF, QPixmap, QRectF): not enough arguments
drawPixmap(self, QRect, QPixmap, QRect): argument 1 has unexpected type 'QRectF'
drawPixmap(self, Union[QPointF, QPoint], QPixmap): argument 1 has unexpected type 'QRectF'
drawPixmap(self, QPoint, QPixmap): argument 1 has unexpected type 'QRectF'
drawPixmap(self, QRect, QPixmap): argument 1 has unexpected type 'QRectF'
drawPixmap(self, int, int, QPixmap): argument 1 has unexpected type 'QRectF'
drawPixmap(self, int, int, int, int, QPixmap): argument 1 has unexpected type 'QRectF'
drawPixmap(self, int, int, int, int, QPixmap, int, int, int, int): argument 1 has unexpected type 'QRectF'
drawPixmap(self, int, int, QPixmap, int, int, int, int): argument 1 has unexpected type 'QRectF'
drawPixmap(self, Union[QPointF, QPoint], QPixmap, QRectF): argument 1 has unexpected type 'QRectF'
drawPixmap(self, QPoint, QPixmap, QRect): argument 1 has unexpected type 'QRectF'
Describe the bug
Traceback (most recent call last):
File "D:\Source\PyQt-Fluent-Widgets-master\examples\gallery\demo.py", line 9, in
from app.view.main_window import MainWindow
File "D:\Source\PyQt-Fluent-Widgets-master\examples\gallery\app\view\main_window.py", line 13, in
from .gallery_interface import GalleryInterface
File "D:\Source\PyQt-Fluent-Widgets-master\examples\gallery\app\view\gallery_interface.py", line 6, in
from qfluentwidgets import (ScrollArea, PushButton, ToolButton, FluentIcon,
ImportError: cannot import name 'PushButton' from 'qfluentwidgets' (C:\Users\YinBuLiao\AppData\Roaming\Python\Python311\site-packages\qfluentwidgets_init_.py)
Environment
To Reproduce
cd examples/gallery
python demo.py
Describe the bug
多显示屏环境下运行menu\demo.py与combo_box\demo.py运行异常。
副屏显示主窗体,会在主屏幕显示RoundMenu与ComboBox。
具体效果见截图。
Environment
To Reproduce
在副屏运行demo,右键主窗体或点击主窗体中的comboBox即可触发。
Expected behavior
多选栏和上下文菜单在争取位置显示。
FluentIcon是继承的Enum,没办法继续扩展,只能按FluentIcon的结构重写一个我自己的MyIcon类,但是在icon.py的drawIcon方法里面, 只有instance是FluentIcon类才会执行icon.rende,这样我的MyIcon类就没办法执行了,只能传入QIcon或者icon路径,这样我就不能集中维护我自己的图标了,drawicon方法能否优化一下,还是说有其他方法可以实现。感谢
在此之前我以pip install -r requirements.txt
安装了依赖库,在试图运行tool_tip时出现问题
不论我是cd到tool_tip目录下还是项目根目录都没用
Traceback (most recent call last):
File "/home/xian/文档/PyQt-Fluent-Widgets/examples/tool_tip/demo.py", line 6, in <module>
from qfluentwidgets import ToolTip
ModuleNotFoundError: No module named 'qfluentwidgets'
目前的消息提醒都是消息对话框的形式,能否添加一个toast提示的组件,不用用户二次确认,直接提醒,1到2秒后自动消失
例如参考下面:
https://element-plus.gitee.io/zh-CN/component/message.html#%E4%B8%8D%E5%90%8C%E7%8A%B6%E6%80%81
具体表现为添加播放器组建后,打开页面无法立即渲染,需要变化页面大小后(通过放大缩小或者左侧菜单变化后)才可以出现
Describe the bug
A clear and concise description of what the bug is.
Environment
OS: [Windows10]
Python: [e.g. 3.10.9 64-bit]
File "D:\Dev\PyQt-Fluent-Widgets\examples\gallery\demo.py", line 9, in
from app.view.main_window import MainWindow
File "D:\Dev\PyQt-Fluent-Widgets\examples\gallery\app\view\main_window.py", line 21, in
from .status_info_interface import StatusInfoInterface
File "D:\Dev\PyQt-Fluent-Widgets\examples\gallery\app\view\status_info_interface.py", line 5, in
from qfluentwidgets import (StateToolTip, ToolTipFilter, PushButton, PixmapLabel,
ImportError: cannot import name 'InfoBar' from 'qfluentwidgets' (C:\Users\GRBJ200045.conda\envs\ti-build\lib\site-packages\qfluentwidgets_init_.py)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.