snoofkin
snoofkin

Reputation: 8895

Q_PROPERTY in Qt?

I cant really figure out why do I need it, Been reading: http://doc.qt.io/qt-4.8/properties.html#requirements-for-declaring-properties

still cant really understand the use of it. any kind of help would be great!

Upvotes: 9

Views: 12552

Answers (2)

ismail
ismail

Reputation: 47672

Read about the Qt Property System , this is just like a usual class method but it can be used with Qt's meta-object system:

 QPushButton *button = new QPushButton;
 QObject *object = button;

 button->setDown(true);
 object->setProperty("down", true);

Also these properties will be visible under Qt Designer too so you could create a custom widget with some properties and hook it up in Qt Designer, see this article for details.

Upvotes: 12

Sulla
Sulla

Reputation: 8019

Properties help in RTTI like implementation using Qt's Meta object system.

Upvotes: 0

Related Questions