PDA

View Full Version : Why and when to use Q_PROPERTY



Vanir
21st November 2007, 10:09
Hello All,

I am new to QT and am learning it for my present job so I apologize for any dum questions.

I have read the information on the Qt Assistant regarding the macro Q_PROPERTY. Although Assistant gives the 'syntax' it does not give the why and when to insert such properties into a class derived from QObject.

What criteria should I use to decide to create / insert properties in my class designs derived from QObject?

Does the Qt framework make use of them?

The same questions are asked of the use of dynamic properties.

Thanks,

Vanir

jpn
21st November 2007, 10:12
I have read the information on the Qt Assistant regarding the macro Q_PROPERTY. Although Assistant gives the 'syntax' it does not give the why and when to insert such properties into a class derived from QObject.
In Q_PROPERTY (http://doc.trolltech.com/4.3/qobject.html#Q_PROPERTY) docs, there's a link to more verbose article: Qt's Property System (http://doc.trolltech.com/4.3/properties.html)

mchara
21st November 2007, 11:07
Hi,
there's no dum questions ;)
rather not asking is dummy

Q_PROPERTY is required whne developing QtDesigner plugins(that extends designer by new custom widgets).
Q_PROPERTY macro adds informations that allow designer to add a property t property editor (and change its value at design time).

It can be omitted in other cases, so u may ignore it until first QtDesigner plugin writing.

jacek
21st November 2007, 15:09
Properties are also useful in scriptable objects.

Vanir
22nd November 2007, 09:25
Hi Everyone,

Thank you for your hard-earnt knowledge.

I am sure to post again.

Vanir