Animated QGraphicsOpacityEffect widget is partially opaque until clicking on window



  • I have a QGraphicsView (under QMainWindow) with a pop-up QWidget for item properties which fades in with QGraphicsOpacity effect. The problem is that when I start the animation the outer frame of the widget fades in as expected, but the contents of the widget remains transparent until I click somewhere on the window.

    Thoughts?

            self.effect = QGraphicsOpacityEffect(self)
            self.setGraphicsEffect(self.effect)
            self.opacityAnimation = QPropertyAnimation(self.effect, b'opacity')
            self.opacityAnimation.setDuration(300)
    	self.opacityAnimation.finished.connect(self.onOpacityDone)
    
        def show(self):
            super().show()
            self.opacityAnimation.setStartValue(0)
            self.opacityAnimation.setEndValue(1)
            self.opacityAnimation.start()
    
        def hide(self):
            self.person = None
            if self.opacityAnimation.finished():
                self.opacityAnimation.setStartValue(0)
                self.opacityAnimation.setEndValue(1)
                self.opacityAnimation.start()
            else:
                super().hide()
    
        def onOpacityDone(self):
            if self.opacityAnimation.currentValue() == 0:
                super().hide()
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.