Go to the myscene.h file and add a private qreal m_jumpFactor field. Next, declare a getter, a setter, and a change signal for this field:
public: //... qreal jumpFactor() const; void setJumpFactor(const qreal &jumpFactor);signals: void jumpFactorChanged(qreal);
In the header file, we declare the jumpFactor property by adding the following code just after the Q_OBJECT macro:
Q_PROPERTY(qreal jumpFactor READ jumpFactor WRITE setjumpFactor NOTIFY jumpFactorChanged)
Here, qreal is the type of the property, jumpFactor is the registered name, and the following three lines register the corresponding member functions of the MyScene class in the property system. We'll need this property to make Benjamin jump, ...