在 PyQt 中运行无框架小部件时,我注意到一个奇怪的行为。 如果我在任务栏中多次最小化它,Windows XP 标题栏会在几毫秒内出现在左上角,然后消失。
这是重现该问题的简单代码:
import sys
from PyQt5 import QtCore, QtWidgets
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
ui = QtWidgets.QWidget()
ui.setWindowFlags(ui.windowFlags() | QtCore.Qt.FramelessWindowHint)
ui.show()
sys.exit(app.exec_())
此行为描述于 video
我的设置是 Windows 7 (x64)、Python 3.5 和 PyQt5.7 (仅供引用,这个问题在PyQt5.6中也存在)
任何人都可以解释这种行为并给出解决方案吗?
最佳答案
我举报了issue到 Qt,这似乎是一个常见的 Windows 错误:
Sergio Martins added a comment
I can reproduce this problem with a pure Windows example, (passing WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX to CreateWindowEx()). Doesn't seem fixable, other than removing the minimize button capability.
关于python - pyqt - 无框架小部件出现奇怪的标题栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40559125/