zhiyiYo / PyQt-Frameless-Window

A cross-platform frameless window based on pyqt5, support Win32, Linux and macOS.
https://pyqt-frameless-window.readthedocs.io
GNU General Public License v3.0
485 stars 67 forks source link

windowEffect isn't work in KDE #63

Closed ovo-Tim closed 1 year ago

ovo-Tim commented 1 year ago

Describe the bug The window will be black

Environment OS:

 ❯ neofetch
       _,met$$$$$gg.          tim@tim 
    ,g$$$$$$$$$$$$$$$P.       ------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 11 (bullseye) x86_64 
 ,$$P'              `$$$.     Host: 81BV Lenovo ideapad 720S-13IKB 
',$$P       ,ggs.     `$$b:   Kernel: 5.10.0-21-amd64 
`d$$'     ,$P"'   .    $$$    Uptime: 7 hours, 25 mins 
 $$P      d$'     ,    $$P    Packages: 3310 (dpkg), 10 (flatpak), 2 (snap) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.1.4 
 $$;      Y$b._   _,d$P'      Resolution: 1920x1080 
 Y$$.    `.`"Y$$$$P"'         DE: Plasma 5.20.5 
 `$$b      "-.__              WM: KWin 
  `Y$$                        Theme: NephriteLight [Plasma], Breeze [GTK2/3] 
   `Y$$.                      Icons: breeze-dark [Plasma], breeze-dark [GTK2/3] 
     `$$b.                    Terminal: konsole 
       `Y$$b.                 Terminal Font: Hack [SRC] 10 
          `"Y$b._             CPU: Intel i5-8250U (8) @ 3.400GHz 
              `"""            GPU: Intel UHD Graphics 620 
                              Memory: 5811MiB / 7706MiB 

Code

import sys

from PySide6.QtWidgets import QApplication
from PySide6.QtCore import *
from qframelesswindow import *

class Window(AcrylicWindow):

    def __init__(self, parent=None):
        super().__init__(parent=parent)
        self.setWindowTitle("PyQt-Frameless-Window")
        self.titleBar.raise_()
        self.setAcrylicEffectEnabled(True)

    def setAcrylicEffectEnabled(self, enable: bool):
        """ set acrylic effect enabled """
        self.setStyleSheet(f"background:{'transparent' if enable else '#F2F2F2'}")
        if enable:
            self.windowEffect.setAcrylicEffect(self.winId(), "F2F2F299")
            if QOperatingSystemVersion.current() != QOperatingSystemVersion.Windows10:
                self.windowEffect.addShadowEffect(self.winId())
        else:
            self.windowEffect.addShadowEffect(self.winId())
            self.windowEffect.removeBackgroundEffect(self.winId())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    demo = Window()
    demo.show()
    sys.exit(app.exec_())

Screenshots 图片

zhiyiYo commented 1 year ago

WindowEffect only works on Windows 10+ and macOS