I can not get methods from QMetaObject, methods offset and count are equals
i have a class that inherits from QObject and have the Q_OBJECT macro:
in another class in the same header i create an instance of that class, and then i try to get all Methods from 'SomeClass' and store it in a QMap:
...
But this do not showed me any method added because the methods offset is equals to the methods count, why can be? i dont get with the reason, Thanks any help. |
|||||
|
You need to use the
You can also use the QMetaObject is only aware of signals, slots, properties and other invokable member functions, occasionally referred to as "meta-methods" as a group. Also, for the first line of your example, you should (probably) just call
This isn't just cosmetic. The You don't actually need an instance of the class to get the meta-object:
This is possible because there is one QMetaObject per class, not per object. For anyone who wants to know more about the meta-object system, I recommend coffee and the documentation. Usually you don't need to deal with QMetaObject instances directly, unless you're writing a scripting engine or something equally 'meta'. It's easy to unintentionally duplicate functionality Qt already provides. Also, |
|||||||||
|
There is some kind of ambiguity in the official docs. First we see:
But later:
But actually we can't have access to 'normal' methods through Qt MetaObject System. So, to get access to your methods, you should declare them with the
|
|||||||||||||
|