PDA

View Full Version : QMetaProperty to identify custom property



anbu01
7th May 2014, 11:16
hi,
I am working on QMetaObject to read all property of a QObject.My Doubt is can we differentiate between a user Defined property(property added by myself) and default property (i.e) already available in qt .I gone through docs but cudn't find good method to do the task.
thanks,

anda_skoa
7th May 2014, 11:49
If you look at QMetaObject it has a property offset that tells you which property is the first of the respective class in the inheritance hierachy.

So if you work through the properties starting at QObject, you'll know when you've reached the first class of your own.

Cheers,
_

anbu01
7th May 2014, 12:56
tanks, but the problem is property offset return similliar for my custom class as well as its parent class for e.g the propertyOffset() of all properties of MyPushButton and QPushButton all gives the same index.

anda_skoa
7th May 2014, 16:24
Can you show the code you are using?

Cheers,
_

ChrisW67
8th May 2014, 00:47
I have a feeling of déjà vu about this thread. Same poster, same problem as here