python - pyqt - 无框架小部件出现奇怪的标题栏

标签 python qt python-3.x pyqt pyqt5

在 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/

相关文章:

python - Django 1.8 RC1 : ProgrammingError when creating database tables

c++ - 如何在 QT 中创建具有多个属性的按钮?

python - numpy 的按位运算

Python/OpenCV —细菌簇中的质心确定

python - macOS Sierra - 如何使用命令行启用 "Allow Remote Automation"

Python:导入模块麻烦,取决于运行模式

python - 无法使用 boto3 更新 Route 53 上的 DNS 记录

c++ - Qt 中的 GIF 动画

javascript - JavaScript 中的屏幕对象在 QWebEnginePage 中不可用

python - 将信息从字符串转换为字典