QPropertyAnimation use of undeclared identifier rotation 怎么处理
"rotation" is not a predefined property in the QPropertyAnimation class. To resolve this error, you need to specify a valid property of the target object that you want to animate.
Here is an example of how to use QPropertyAnimation to animate the rotation property of a QGraphicsItem:
QGraphicsItem* item = ...; // Your QGraphicsItem object
QPropertyAnimation* animation = new QPropertyAnimation(item, "rotation");
animation->setDuration(1000); // Animation duration in milliseconds
animation->setStartValue(0); // Start rotation value
animation->setEndValue(360); // End rotation value
animation->start(); // Start the animation
In this example, we are animating the "rotation" property of a QGraphicsItem. Make sure to replace item with your actual QGraphicsItem object.
If you want to animate a different property, you need to replace "rotation" with the desired property name. You can check the documentation of the target object to find the available properties that you can animate.
原文地址: https://www.cveoy.top/t/topic/jete 著作权归作者所有。请勿转载和采集!