PyQt-Frameless-Window
PyQt-Frameless-Window copied to clipboard
[Bug]: 无边框对话框打开的一瞬间会显示最大,最小,关闭按钮
What happened?
无边框对话框打开的一瞬间会显示最大,最小,关闭按钮,然后再消失
Operation System
windows10
Python Version
3.10.7-64bit
PyQt/PySide Version
pyside6.6.2
PyQt/PySide-Fluent-Widgets Version
1.5.3
How to Reproduce?
点击按钮,弹出无边框对话框
Minimum code
# coding:utf-8
import sys
from PySide6.QtWidgets import QApplication, QWidget
from qfluentwidgets import Dialog, PrimaryPushButton
class Demo(QWidget):
def __init__(self, parent=None):
super().__init__(parent=parent)
self.resize(950, 500)
self.btn = PrimaryPushButton('Click Me', parent=self)
self.btn.move(425, 225)
self.btn.clicked.connect(self.showDialog)
self.setStyleSheet('Demo{background:white}')
def showDialog(self):
title = 'Are you sure you want to delete the folder?'
content = """If you delete the "Music" folder from the list, the folder will no longer appear in the list, but will not be deleted."""
w = Dialog(title, content, self)
if w.exec():
print('Yes button is pressed')
else:
print('Cancel button is pressed')
if __name__ == '__main__':
app = QApplication(sys.argv)
w = Demo()
w.show()
app.exec()
无法复现,相同代码运行正常
https://github.com/zhiyiYo/PyQt-Fluent-Widgets/assets/57891940/0f3f51e9-d609-42ee-87b0-ad4cbe239094
我这里看很明显。。
确实有,但是FramelessDialog也会有,建议转移该问题到PyQt-Frameless-Window仓库
但是这个问题应该不影响使用。目前只发现在Windows上能复现,并且在我的环境下必须快速使用Esc关闭对话框才能看到。 应该是和Windows上无边框窗口的实现方式有关的。Windows上无边框窗口是使用FramelessWindowHint + Windows native的flag + WM_NCCALCSIZE 实现的,可能和这些有关,如果不实现WM_NCCALCSIZE就会显示原生的标题栏,也许是Python太慢了?