I need to get QMetaObject for dynamic creation of object instances.
If I khow the object then QObject::metaObject() is what I need. If I know the class then I can use QObject::staticMetaObject variable. But what should I use if I know only class name as a string value?
I need to get QMetaObject for dynamic creation of object instances. If I khow
Share
You ask for a
QMetaObject, but say it is for creation purposes. If that’s all you have to do, QMetaType may well be what you need. You have to register your types with it, but I’m pretty sure QT doesn’t have a master list ofQMetaObjects just floating around by default, so such registration will be necessary no matter what you do.Cursory glance at the documentation isn’t clear on how the memory for
pis allocated, but I assumedestroytakes care of that? Use at your own risk.