还可以使用Q_SIGNAL,Q_EMIT,Q_SLOT避免第三方库的关键字冲突

You can define the QT_NO_KEYWORDS macro, that disables the “signals” and “slots” macros.

If you use QMake:

 CONFIG += no_keywords

(Qt Documentation here)

If you’re using another build system, do whatever it needs to pass -DQT_NO_KEYWORDS to the compiler.

Defining QT_NO_KEYWORDS will require you to change occurrences of signals to Q_SIGNALSand slots to Q_SLOTS in your Qt code.

If you cannot change all the Qt code, e.g. because you're using third-party libraries not being "keyword-clean", you could try to undefine "signals" locally before including cdk.h:

#undef signals
#include <cdk.h>

I'd recommend to use no_keywords though if possible, as it is less tedious and error-prone.

http://stackoverflow.com/questions/22188432/cdk-collides-with-qt-signals

原文地址:https://www.cnblogs.com/findumars/p/6497726.html