init study Qt
This commit is contained in:
33
qperson.h
Normal file
33
qperson.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef QPERSION_H
|
||||
#define QPERSION_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QPerson : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("author", "Ding")
|
||||
Q_CLASSINFO("company", "UPC")
|
||||
Q_CLASSINFO("version", "1.0.0")
|
||||
Q_PROPERTY(int age READ age WRITE setAge NOTIFY ageChanged)
|
||||
Q_PROPERTY(QString name MEMBER m_name)
|
||||
Q_PROPERTY(int score MEMBER m_score)
|
||||
|
||||
private:
|
||||
int m_age=10;
|
||||
QString m_name;
|
||||
int m_score=60;
|
||||
|
||||
public:
|
||||
explicit QPerson(QString fName, QObject *parent = nullptr);
|
||||
int age();
|
||||
void setAge(int val);
|
||||
void incAge();
|
||||
|
||||
signals:
|
||||
void ageChanged(int val);
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // QPERSON_H
|
||||
Reference in New Issue
Block a user