Transpanrent effect isn't working well with QScrollArea
-
I'm studying PySide6.
I want to add transpanrent effect to a QScrollArea. So I use QGraphicsOpacityEffect.
Here is the code:from sys import argv from PySide6.QtCore import QTimer from PySide6.QtWidgets import QLabel, QScrollArea, QFrame, QGraphicsOpacityEffect, QApplication, QMainWindow class Test(QMainWindow): timer = QTimer() def __init__(self, parent=None, *args, **kwargs): super().__init__(parent, *args, **kwargs) self.parent = parent label = QLabel('test\n'*20) label.setStyleSheet('font-size:20px;') scroll_area = QScrollArea() scroll_area.setWidget(label) self.setCentralWidget(scroll_area) opacity = QGraphicsOpacityEffect(scroll_area) opacity.setOpacity(0.5) scroll_area.setGraphicsEffect(opacity) self.show() if __name__ == '__main__': app = QApplication(argv) ex = Test() exit(app.exec())
After running, there are some shadows and without transparent effect.
QGraphicsOpacityEffect works well with the widgets except QScrollArea.
Why? -
S SGaist moved this topic from General and Desktop on