我想将 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.