Calling static function through QMetaObject
-
Why do you want to use invokeMethod() to call a static method?
-
@jsulm Well, because the method that I would like to invoke would not require an instance and therefore a static method is what I prefer. Is there any way to invoke a static method without an instance?
The QMetaObkect::method(index) function also returns me the invokable static methods.
-
hi
Are we talking normal static functions?
http://www.tutorialspoint.com/cplusplus/cpp_static_members.htmso you just call it like
ClassName::static_method()
? -
hi
Are we talking normal static functions?
http://www.tutorialspoint.com/cplusplus/cpp_static_members.htmso you just call it like
ClassName::static_method()
? -
@mrjj Yes, a standard C++ static member function which is defined with Q_INVOKABLE. I will not only know at runtime which staticMetaObject I have to call this function. Therefore I can not use ClassName::static_method().
-
This is not possible with current API. Take a look at the generated
moc_*.cpp
file. The methods called via meta objects are always routed throughYourClass::qt_static_metacall
and it always takes an object pointer. -
This is not possible with current API. Take a look at the generated
moc_*.cpp
file. The methods called via meta objects are always routed throughYourClass::qt_static_metacall
and it always takes an object pointer.@Chris-Kawa Thanks for the information provided. Then I need to re-design my implementation accordingly to this limitation.