Skip to content

[BUG]Windows 7 下错误的渲染 Aero 效果 #189

@XiaoYouChR

Description

@XiaoYouChR

Describe the bug
A clear and concise description of what the bug is.
在手动 self.windowEffect.setAeroEffect 之前仍会渲染 Aero 效果, 导致窗口拖动时看起来很奇怪

Environment
环境信息

  • OS: Windows 7
  • DPI scaling: Any
  • Python: 3.11.12 64-bit
  • PySide6: 6.7.2

To Reproduce
复现问题的步骤,推荐使用 gif 进行演示。

QQ202553-174449-HD.mp4

Code
最小复现代码

# coding:utf-8
import sys

from PySide6.QtGui import QPixmap, QIcon
from PySide6.QtWidgets import QApplication, QLabel, QComboBox

from qframelesswindow import FramelessWindow, TitleBar

class Window(FramelessWindow):

    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.setTitleBar(TitleBar(self))

        self.label = QLabel(self)
        self.label.setScaledContents(True)
        self.label.setPixmap(QPixmap("screenshot/shoko.png"))

        self.setWindowIcon(QIcon("screenshot/logo.png"))
        self.setWindowTitle("PySide6-Frameless-Window")
        self.setStyleSheet("background:white")

        self.titleBar.raise_()

        self.comboBox = QComboBox(self)
        self.comboBox.addItems(["None", "Aero"])
        self.comboBox.move(50, 50)
        self.comboBox.activated.connect(self.changeEffect)

    def changeEffect(self, index):
        if index == 1:
            self.windowEffect.setAeroEffect(self.winId())
            self.setStyleSheet("background:transparent")
        else:
            self.windowEffect.removeBackgroundEffect(self.winId())
            self.setStyleSheet("background:white")
    def resizeEvent(self, e):
        super().resizeEvent(e)
        length = min(self.width(), self.height())
        self.label.resize(length, length)
        self.label.move(
            self.width() // 2 - length // 2,
            self.height() // 2 - length // 2
        )


if __name__ == "__main__":
    app = QApplication(sys.argv)
    demo = Window()
    demo.show()
    app.exec()

Expected behavior
在没有 self.windowEffect.setAeroEffect 之前不渲染 Aero 效果.

Screenshots
If applicable, add screenshots to help explain your problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions