PyQt-Fluent-Widgets
PyQt-Fluent-Widgets copied to clipboard
Windows系统的主题色发生改变时,整个界面会自动变白[Bug]:
What happened?
当我改变Windows的主题色时,或将主题色设为“自动”时,应用的整个界面会自动变白
Operation System
Windows11 22H2
Python Version
3.11.4 64bit
PyQt/PySide Version
PySide 6.7.0
PyQt/PySide-Fluent-Widgets Version
v1.5.5
How to Reproduce?
正常状态下:
手动改变系统主题色或者因为壁纸软件而自动改变主题色后:
再次手动调整应用内主题后又恢复正常:
奇怪的是,这一切是在使用setTheme()更改主题后发生的,如果全程不使用setTheme()更改主题,就不会出现这种情况,但是我下载了您的高级组件库 试用程序 ,并不会发生这种问题,想了很久想不明白,希望在这里得到解决 以下是最小实现
Minimum code
# coding:utf-8
import sys
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QApplication, QWidget, QHBoxLayout
from qfluentwidgets import MSFluentWindow, FluentIcon as FIF, PushButton, setTheme, Theme
class HomePageWidget(QWidget):
def __init__(self, text: str, parent=None):
super().__init__(parent=parent)
self.text = text
self.start_btn = PushButton(text='开始使用')
self.hBoxLayout = QHBoxLayout(self)
setTheme(Theme.DARK)
self.init()
def init(self):
self.hBoxLayout.addWidget(self.start_btn, 1, Qt.AlignmentFlag.AlignCenter)
self.setObjectName(self.text.replace(' ', '-'))
class Demo(MSFluentWindow):
def __init__(self):
super().__init__()
self.homeInterface = HomePageWidget('Home Page')
self.addSubInterface(self.homeInterface, FIF.HOME, '主页', FIF.HOME)
self.resize(960, 640)
if __name__ == '__main__':
app = QApplication(sys.argv)
w = Demo()
w.show()
app.exec()
附加: 不使用云母效果则不会出现上述情况。 如果使用亚克力效果且不在深色模式下时,则不会上述这种情况。
Same here, reproduce steps:
- Change theme to light mode with mica enabled. Everything works fine but
- Close and open again and this will be happen
This bug happened only with mica enabled and only on light mode. Even exist in the example gallery app
But tricky part is, i test it on another windows pc and everything fine. And this bug happened only on my own pc I believe related to windows or windows theme maybe
Same here, reproduce steps:
- Change theme to light mode with mica enabled. Everything works fine but
- Close and open again and this will be happen
This bug happened only with mica enabled and only on light mode. Even exist in the example gallery app
But tricky part is, i test it on another windows pc and everything fine. And this bug happened only on my own pc I believe related to windows or windows theme maybe
现在能想到的解决办法是: 1:不启用云母效果,但是这样的话,用鼠标拖动改变窗口大小时,会出现原生窗口的残影,所以我想解决在启用云母效果的情况下,界面自动变白的问题。 2:使用亚克力效果,但是这样就不能使用setTheme()改变主题,否则会出现上述问题
你的另一台pc系统版本号是什么?如果你找到解决办法请回复
用作者的 预览程序 并不会出现上述问题,我猜测可能与PySide6版本,PySide-Fluent-Widgets版本有关
As i said it only happened in my windows so problem must be in my side, not code or other things and i don't think this issue reported before. So i don't use mica myself، but code and app not have any problem on other device.
Windows 11 22h2 Pyqt 5.15 Qt5 Fluent 1.5.2
As i said it only happened in my windows so problem must be in my side, not code or other things and i don't think this issue reported before.正如我所说,它只发生在我的窗口中,所以问题必须出在我这边,而不是代码或其他东西,我认为这个问题以前没有报告过。 So i don't use mica myself، but code and app not have any problem on other device.所以我自己不使用云母,但代码和应用程序在其他设备上没有任何问题。
Windows 11 22h2 Pyqt 5.15 Qt5 Fluent 1.5.2
谢谢你的回复
无法复现,可能是操作系统的问题