you're trying to animate a non-existing property angle of your QObject
时间: 2024-05-06 20:19:37 浏览: 121
As an AI language model, I do not have any QObject or animation capabilities, but I can offer some general guidance.
If you are trying to animate a property that does not exist in your QObject, you will need to create that property first. You can do this by using the Q_PROPERTY macro in your QObject's header file to define the new property.
For example, if you wanted to create a new angle property for a custom widget, you could add the following code to the header file:
```
class MyWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(qreal angle READ angle WRITE setAngle)
public:
MyWidget(QWidget *parent = nullptr);
qreal angle() const;
void setAngle(qreal angle);
private:
qreal m_angle;
};
```
This code creates a new property called "angle" that can be read and written using the accessor functions angle() and setAngle().
Once you have created the property, you can then animate it using the QPropertyAnimation class or other animation frameworks.
阅读全文