Unsolved Cpp check marking Q_INVOKABLE member functions as unused
-
Hi all,
When I'm trying to run cppcheck with my source code. After static code check cppcheck showing Q_INVOKABLE member functions as unused ones. But those functions have been used from qml's.
Since my other c++ project are running with cppcheck tool, I want to strict with the same tool for Qt project too. Please let me know is it possible?
-
No direct way exist. You need to make some fooling around for compiler as if you are using this method. Something like typecasting method to void pointer or taking the address of method etc. I have not tried though.
-
@R_ram
to build up on what @dheerendra said,you can try if this would be enough to fool your compiler. It's a 1:1 redefinishion on Q_UNUSED
#define Q_USED_BY_QML(x) (void)x; .... Q_USED_BY_QML(qmlFuntion())
-
Thanks for your suggestions.
Instead, cppcheck if I'm using qt clang tool will it helpful in the above scenario. If it clang is helpful how to use as command-line usage.
thanks in advance.