I have some code files that I would like to share between different platforms (some of which are not supported by Qt). I want to be able to check if it the file is being compiled in a Qt environment and then use some Qt features. Is there a #define that can be checked for presence of the Qt framework to achieve this?
Hypothetical example:
#ifdef QT_FRAMEWORK_AVAILABLE
#include <QApplication>
double randomInRange(double min, double max)
{
return min + (max - min) * ((double)qrand() / (RAND_MAX + 1));
}
#elseif
double randomInRange(double min, double max)
{
return min + (max - min) * ((double)rand() / (RAND_MAX + 1));
}
#endif
↧