Сбой QPainter при использовании QPropertyAnimation - PullRequest
0 голосов
/ 09 апреля 2019

Я хочу использовать graphicsOpacityEffect в propertyAnimation для 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.
...