Project wizards: warn when using deprecated APIs in new projects

As discussed at QtCS, almost none of our users know that they can
get warnings when they use deprecated APIs, and/or disable them
altogether. A first step would be getting the relevant defines added
by the new project wizards.

Change-Id: I5d4260b5aa094ac2a077b7b00eaa577108e5f612
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Giuseppe D'Angelo
2016-10-10 16:57:22 +01:00
parent ed7d13b6fc
commit e9aaf017c2
6 changed files with 68 additions and 0 deletions

View File

@@ -112,6 +112,19 @@ void QtProjectParameters::writeProFile(QTextStream &str) const
if (!targetDirectory.isEmpty())
str << "\nDESTDIR = " << targetDirectory << '\n';
if (qtVersionSupport != SupportQt4Only) {
str << "\n"
"# The following define makes your compiler emit warnings if you use\n"
"# any feature of Qt which as been marked as deprecated (the exact warnings\n"
"# depend on your compiler). Please consult the documentation of the\n"
"# deprecated API in order to know how to port your code away from it.\n"
"DEFINES += QT_DEPRECATED_WARNINGS\n\n"
"# You can also make your code fail to compile if you use deprecated APIs.\n"
"# In order to do so, uncomment the following line.\n"
"# You can also select to disable deprecated APIs only up to a certain version of Qt.\n"
"#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0\n";
}
}
void QtProjectParameters::writeProFileHeader(QTextStream &str)