看到关于Q_PROPERTY属性设置的问题,所以再看看内联函数的知识:转载地址
Q_PROPERTY(int age_ READ age WRITE setAge)
// Property code start
private: int age_;
public: Q_SLOT inline int age() const
{ return age_; }
public: Q_SLOT inline void setAge(const int &newValue)
{ if ( newValue == age_ ) { return; } age_ = newValue; }
private:
// Property code end