Using QMetaObject
I am able to browse all properties defined at compile-time using Q_PROPERTY
macro...
Now I would be able to browse all dynamic properties added at run-time using setProperty()
...
Is it possible?
You can get the list of all dynamic properties using QObject::dynamicPropertyNames()
. For example:
QList<QByteArray> dynamicProperties = object->dynamicPropertyNames();
To get the property value use the same QObject::property(const char * name )
function:
QVariant val = object->property(name );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.