Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Transpanrent effect isn't working well with QScrollArea
Forum Updated to NodeBB v4.3 + New Features

Transpanrent effect isn't working well with QScrollArea

Scheduled Pinned Locked Moved Unsolved Qt for Python
1 Posts 1 Posters 155 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Moonsea
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • SGaistS SGaist moved this topic from General and Desktop on

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved