PDA

View Full Version : Know Number of Property Exposed by the Widget



Ashutosh2k1
28th June 2011, 13:44
HI
I just want to know is there any method through which u can know that this widget or dialog will expose some property . I have read about Qt Meta object but it is not working .

Rachol
28th June 2011, 13:50
Will this work for you?


QVariant QObject::property ( const char * name ) const

Ashutosh2k1
28th June 2011, 13:57
Hi
Thanks, But what i want that by any method i will get the toal No of Property from the widget . In this case what we actually get the value of that property ,I want just name of the Property
So for QWidget if there 30 Property I want a fn which will return that QWidget has 30 property. Also either through indexing or by any means i want to know the property exposed by the QWidget So like Enabled ,Geometry maximumheight etc

Rachol
28th June 2011, 14:02
Doesn't this work?


const QMetaObject* metaObject = obj->metaObject();
QStringList properties;
for(int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i)
properties << QString::fromLatin1(metaObject->property(i).name());

Ashutosh2k1
29th June 2011, 13:12
Hi
Thanks This works