Unsolved What is Qt's macro "Q_OVERRIDE" used for?
-
I find this macro by accident. By curiosity, I want to know how this macro used, better to give me a code snippet.
-
Hi @jiancaiyang,
where did you find this macro?
I only know Q_DECL_OVERRIDE and this was used to introduce the C++11 override keyword while keeping compatibility to non-C++11 compilers.
On a non-C++11 compiler it is defined as nothing. Nowadays (Qt 5.7+) C++11 is always required and the macro is gradually replaced with override.
Regards.
-
@aha_1980
at /Qt5.10.0/5.10.0/clang_64/lib/QtCore.framework/Headers/qobjectdefs.h:117You can find this macro.
But this macro has one argument, I guess it is not used to be compatible with STD C++ 11 override. -
The macro was added in 6c54e10. Looks like it evaluates to nothing, and was intended to provide meta data for auto-documenting tools?
Seems it never got used beyond a couple of properties in
QTextBrowser
? https://github.com/qt/qtbase/search?utf8=✓&q=Q_OVERRIDE&type=