PDA

View Full Version : What is the meaning of 'NO' in names like QT_NO_ITEMVIEWS?



neuronet
4th December 2015, 15:45
I'm working through some Qt code, and there are a bunch of places you find include guards like:

#ifndef QT_NO_ITEMVIEWS
I'm curious what the 'NO' means here? At first I thought it meant 'no', like 'no item views allowed'. Obviously that is silly. This nomenclature is used for every feature. List of such features is found here:
http://realxtend-naali-deps.googlecode.com/svn-history/r83/bin/build_deps/Qt/include/QtCore/qfeatures.h
http://code.metager.de/source/xref/lib/qt/src/corelib/global/qfeatures.txt
They are defined here:
https://github.com/openwebos/qt/blob/master/util/scripts/make_qfeatures_dot_h

I've searched some, and cannot find what this NOmenclature means. Likely an acronym, but for what?

ChrisW67
4th December 2015, 20:05
NO means no.

By default the vast majority of optional features in Qt are turned on by default. When building Qt you can choose to turn these off and doing so puts a define like QT_NO_ITEMVIEWS into the Qt headers (qfeatures.h) of the built libraries.

Application code can use these defines to avoid the features that are disabled but not essential to the program. Alternatively, fail to build if built with a library that has an essential feature compiled out


#ifndef QT_NO_IMAGEFORMAT_BMP
// do stuff with BMP format files
#endif

#ifdef QT_NO_IMAGEFORMAT_PNG
#error "Cannot compile without PNG support in the Qt library"
#endif

neuronet
5th December 2015, 23:23
OK so these are basically acting like flags. Very helpful to know!