I'm using Pycharm to develop a PyQt6 Application on Mac Air2. When I slide the touch pad with three fingers to open "Mission Control", there will be a transparent layer overlapped under the TextWindow( TetxWindow with a layer and also a transparent layer ). It looks like that the text is carved on a transparent layer. My Mainwondow has the same problem, but it doesn't affect my process, so fine by me. But this in TextWindow really affects visuals.
Also it seems like that the weird layer's position is related to the speed I slide my touch pad.
from PyQt6.QtWidgets import QWidget, QLabel
from PyQt6.QtCore import Qt
from PyQt6.QtWidgets import QApplication
import sys
class TextWindow(QWidget):
def __init__(self):
super().__init__()
self.setWindowFlags(Qt.WindowType.FramelessWindowHint | Qt.WindowType.WindowStaysOnTopHint)
self.setStyleSheet("background-color: rgba(0, 0, 0, 10);")
self.setGeometry(1000, 150, 400, 150)
self.text_label = QLabel("A weird transparent layer overlapped", self)
self.set_label_style(self.text_label)
def set_text(self, text):
self.text_label.setText(text)
@staticmethod
def set_label_style(tmp_label):
tmp_label.resize(400, 150)
tmp_label.setWordWrap(True)
tmp_label.setStyleSheet("background-color: rgba(0, 0, 0, 10); color: #339999; font-size: 16px;")
tmp_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
def text_update(self, text):
self.text_label.setText(text)
app = QApplication(sys.argv)
translate_display = TextWindow()
translate_display.show()
sys.exit(app.exec())
Before, I thought it was the QWidget's layout that's causing this problem. Now I habe deleted all layouts from TextWindow and the weird layer is still here.
Screenshot:
Even if the weird layer is not obvious, I can still see the carved words.