Wednesday, April 5, 2017

Make the compiler fail if using deprecated Qt features

Instead of making the compiler warn you if using deprecated Qt features (see previous post), by using QT_DISABLE_DEPRECATED_BEFORE it's even possible to make your code fail to compile if you use deprecated APIs.
Again, by using such keyword in your project file (.pro) it's also possible to select to disable deprecated APIs only up to a certain version of Qt, see the following example:

DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050000
# disables all the APIs deprecated before Qt 5.0.0

No comments:

Post a Comment