diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2023-12-03 22:19:02 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-03-13 13:08:29 +0100 |
commit | 3a6c8e02b6d1b0574da52b0087092d0c74aa92c1 (patch) | |
tree | 78c006c0659e2b06bf0363a1a973661e4415613f /src/corelib/global/qglobal.cpp | |
parent | 03baf08d2bb99bf234d5e051691a57937fa935d7 (diff) |
Long live QT_ENABLE_STRICT_MODE_UP_TO
We already have fine-grained macros to individually disable APIs
that we consider "suboptimal" or "dangerous". This commit adds
a shortcut for the user to set all such macros in one go.
QT_ENABLE_STRICT_MODE_UP_TO is versioned, just like
QT_DISABLE_DEPRECATED_UP_TO; the idea is that users should set it
to the minimum Qt version they want to support.
Also, if QT_DISABLE_DEPRECATED_UP_TO is not set, then
QT_ENABLE_STRICT_MODE_UP_TO will set it as well, to the same value.
[ChangeLog][QtCore][QtGlobal] Added the QT_ENABLE_STRICT_MODE_UP_TO
macro.
Change-Id: I5466465986104e047a6a86369928be9294f24ab7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/global/qglobal.cpp')
-rw-r--r-- | src/corelib/global/qglobal.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 276f8ab1ad..9a7531e4c5 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -310,6 +310,51 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) qMove takes an rvalue reference to its parameter \a x, and converts it to an xvalue. */ +/*! + \macro QT_ENABLE_STRICT_MODE_UP_TO + \relates <QtGlobal> + \since 6.8 + + Defining this macro will disable a number of Qt APIs that are + deemed suboptimal or dangerous. + + This macro's value must be set to a Qt version, using + \l{QT_VERSION_CHECK}'s encoding. For instance, in order to set it + to Qt 6.6, define \c{QT_ENABLE_STRICT_MODE_UP_TO=0x060600}. + This will disable only the APIs introduced in versions up to (and + including) the specified Qt version. + + If the \l QT_DISABLE_DEPRECATED_UP_TO macro is \e not defined, + then QT_ENABLE_STRICT_MODE_UP_TO will define it as well, + to the same value. + + This macro should always be set to the minimum Qt version that + your project wants to support. + + The APIs disabled by this macro are listed in the table below, + together with the minimum value to use in order to disable them. + + \table + \header \li Version \li Disabled APIs + \row \li 6.0.0 \li \l{foreach-keyword}{foreach} (see \l{QT_NO_FOREACH}) + \row \li 6.0.0 \li QString constructors from \c{const char *} (see \l{QT_NO_CAST_FROM_ASCII}) + \row \li 6.0.0 \li QString conversions towards \c{const char *} / QByteArray (see \l{QT_NO_CAST_TO_ASCII}) + \row \li 6.0.0 \li QByteArray implicit conversions towards \c{const char *} (see \l{QT_NO_CAST_FROM_BYTEARRAY}) + \row \li 6.0.0 \li QUrl implicit conversions from QString (see \l{QT_NO_URL_CAST_FROM_STRING}) + \row \li 6.0.0 \li Allowing narrowing conversions in signal-slot connections (see \l{QT_NO_NARROWING_CONVERSIONS_IN_CONNECT}) + \row \li 6.0.0 \li Java-style iterators for Qt containers + \row \li 6.6.0 \li The qExchange() function (see \l{QT_NO_QEXCHANGE}) + \row \li 6.7.0 \li Overloads of QObject::connect that do not take a context object (see \l{QT_NO_CONTEXTLESS_CONNECT}) + \row \li 6.8.0 \li The qAsConst() function (see \l{QT_NO_QASCONST}) + \endtable + + Moreover, individual APIs may also get disabled as part of the + setting of QT_DISABLE_DEPRECATED_UP_TO. Please refer to each class' + documentation for more details. + + \sa QT_DISABLE_DEPRECATED_UP_TO, QT_NO_KEYWORDS, QT_VERSION_CHECK +*/ + namespace QtPrivate { Q_LOGGING_CATEGORY(lcNativeInterface, "qt.nativeinterface") } |