Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. PySide6中为QScrollArea添加QGraphicsOpacityEffect的效果后出现阴影和拖影
Forum Updated to NodeBB v4.3 + New Features

PySide6中为QScrollArea添加QGraphicsOpacityEffect的效果后出现阴影和拖影

Scheduled Pinned Locked Moved Unsolved Chinese
1 Posts 1 Posters 291 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

    这里是简化后的代码:

    from sys import argv
    
    from PySide6.QtCore import QTimer
    from PySide6.QtWidgets import QLabel, QScrollArea, 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())
    

    用的是python3.9.13 pyside6 6.5.0
    别的控件都是正常的,只有QScrollArea出问题
    请问怎么解决呢?

    1 Reply Last reply
    0

    • Login

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