Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
RTTI for non-QObject classes
Eonz last edited by
I am wanting to create a small GUI builder to allow editing of the properties of certain Qt types at runtime with a single function call. To do this it seems I should use QObject::metaObject().
But some of the things I want to make editable (like QVector3D) do not derive from QObject, at least not as far as I can tell. Is there any other way to list the properties of a non-QObject class?
Or will my GUI builder simply have to make special provision for those classes I wish to handle but that do not derive from QObject? In that case I might need to pass a void pointer to my function - how would I safely check if they point to certain types of classes (like QVector3D)?
dangelog last edited by
You can't in C++. QVector3D has no virtuals, thus no virtual table nor RTTI information. You need to use other means to store that information (QVariant / QMetaType come to mind).