[Interest] Child QWidget fade-in with QGraphicsOpacityEffect
Patrick Stinson
patrickkidd at gmail.com
Wed Aug 2 07:43:40 CEST 2017
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 border of the widget fades in as expected, but the contents of the widget remains transparent until I click somewhere on the window. Seem like a Qt bug.
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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170801/00e14cb6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1403 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170801/00e14cb6/attachment.bin>
More information about the Interest
mailing list