View Full Version : enlighten me on the use of Q_PROPERTY!!
nupul
3rd April 2006, 05:06
Hi,
Why should one use Q_PROPERTY? as in what advantage does it have over declaring the corresponding attributes and associated READ and WRITE functions as private/public??
Thanks
Properties can be written and read through QObject interface.
You can access the properties without knowing anything about the class in use.
Qt's Property System (http://doc.trolltech.com/4.1/properties.html)
It's not the fastest possible way to access data members of a class, the value of properties comes from genericity.
jacek
3rd April 2006, 09:51
Why should one use Q_PROPERTY?
It's used for example by the Qt Designer to change widgets' settings.
what advantage does it have over declaring the corresponding attributes and associated READ and WRITE functions as private/public??
Actually you will still need to write such methods. Q_PROPERTY just informs Qt about them.
nupul
3rd April 2006, 09:55
Actually you will still need to write such methods. Q_PROPERTY just informs Qt about them.
how does this help? i mean how is it different from declaring a private attribute and corresponding methods..Any advantage?
jacek
3rd April 2006, 10:02
Any advantage?
Look at the Qt Designer --- it doesn't know anything about custom widgets, yet if you create a custom widget plugin, you will be able to change that widgets' properties. How would you implement this without Q_PROPERTY?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.