Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.
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
--14:08, 21 November 2010 (UTC)