How to use Q PROPERTY
This macro PROPERTY() is used for declaring properties in classes that inherit QObject. Properties behave like class data members, but they have additional features accessible through the Meta-Object System.
How to use Q_PROPERTY()
Some times our application demands that we can access specific member variables of the QObject classes specifically those of the UI elements. This helps us in changing the CSS of the UI element and introducing animation to elements etc.
Qt provides more below types of operation on Q_PROPERTY
The syntax is as follows:
Of above all the most used ones are READ and WRITE
class MyNumberHolder : public QObject
Q_PROPERTY( int number READ number WRITE setNumber )
MyNumberHolder( int value = 0 );
int number() const;
void showNumber() const;
void setNumber( int value );
More information : Q_PROPERTY
--skumar_rao 14:08, 21 November 2010 (UTC)