forked from qt-creator/qt-creator
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:
@@ -10,3 +10,14 @@ CONFIG -= app_bundle
|
|||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
SOURCES += %{MainCppName}
|
SOURCES += %{MainCppName}
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
@@ -11,6 +11,17 @@ RESOURCES += qml.qrc
|
|||||||
# Additional import path used to resolve QML modules in Qt Creator's code model
|
# Additional import path used to resolve QML modules in Qt Creator's code model
|
||||||
QML_IMPORT_PATH =
|
QML_IMPORT_PATH =
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
@@ -13,6 +13,17 @@ QML_IMPORT_PATH =
|
|||||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||||
QML_DESIGNER_IMPORT_PATH =
|
QML_DESIGNER_IMPORT_PATH =
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
@@ -12,6 +12,17 @@ QML_IMPORT_PATH =
|
|||||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||||
QML_DESIGNER_IMPORT_PATH =
|
QML_DESIGNER_IMPORT_PATH =
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
@@ -18,6 +18,17 @@ QML_IMPORT_PATH =
|
|||||||
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
# Additional import path used to resolve QML modules just for Qt Quick Designer
|
||||||
QML_DESIGNER_IMPORT_PATH =
|
QML_DESIGNER_IMPORT_PATH =
|
||||||
|
|
||||||
|
# The following define makes your compiler emit warnings if you use
|
||||||
|
# any feature of Qt which as been marked deprecated (the exact warnings
|
||||||
|
# depend on your compiler). Please consult the documentation of the
|
||||||
|
# deprecated API in order to know how to port your code away from it.
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
|
# You can also make your code fail to compile if you use deprecated APIs.
|
||||||
|
# In order to do so, uncomment the following line.
|
||||||
|
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||||
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
# Default rules for deployment.
|
# Default rules for deployment.
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
|
@@ -112,6 +112,19 @@ void QtProjectParameters::writeProFile(QTextStream &str) const
|
|||||||
|
|
||||||
if (!targetDirectory.isEmpty())
|
if (!targetDirectory.isEmpty())
|
||||||
str << "\nDESTDIR = " << targetDirectory << '\n';
|
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)
|
void QtProjectParameters::writeProFileHeader(QTextStream &str)
|
||||||
|
Reference in New Issue
Block a user