使用QPropertyAnimation时QPainter崩溃

时间:2019-04-09 16:21:00

标签: pyqt qpainter qpropertyanimation

我想将propertyAnimation中的graphicsOpacityEffect用于包含带有像素映射标签的QFrame。我的代码是:

eff = QGraphicsOpacityEffect(frame)
widget.setGraphicsEffect(eff)            

animation = QPropertyAnimation(eff, b"opacity")
animation.setStartValue(0)
animation.setEndValue(1)
animation.setDuration(500)
animation.setEasingCurve(QEasingCurve.InBack)
animation.start(QPropertyAnimation.DeleteWhenStopped)

一切正常,但是当我将标签悬停在标签上时,图像消失了,并且得到如下警告:

QPainter::setWorldTransform: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::translate: Painter not active
QPainter::worldTransform: Painter not active
QWidgetEffectSourcePrivate::pixmap: Painter not active
QPainter::worldTransform: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::setWorldTransform: Painter not active
QPainter::begin: A paint device can only be painted by one painter at a time.

0 个答案:

没有答案