QT下识别MAC,WINDOWS,LINUX的方法
.h文件
#include <QtGlobal>
class myClass {
Q_OBJECT
....
}
.c文件
class myClass {
void yourFunction(){
#ifdef Q_OS_WIN
qDebug()<<"windows";
#endif
#ifdef Q_OS_MAC
qDebug()<<"mac";
#endif
#ifdef Q_OS_LINUX
qDebug()<<"linux";
#endif
}
}