diff --git a/cmake/QtInternalTargets.cmake b/cmake/QtInternalTargets.cmake index dc69af9acd1..bdba1b5be14 100644 --- a/cmake/QtInternalTargets.cmake +++ b/cmake/QtInternalTargets.cmake @@ -156,7 +156,7 @@ qt_internal_add_target_aliases(PlatformToolInternal) target_link_libraries(PlatformToolInternal INTERFACE PlatformAppInternal) qt_internal_add_global_definition(QT_NO_JAVA_STYLE_ITERATORS) -qt_internal_add_global_definition(QT_NO_AS_CONST) +qt_internal_add_global_definition(QT_NO_QASCONST) qt_internal_add_global_definition(QT_NO_QEXCHANGE) qt_internal_add_global_definition(QT_NO_NARROWING_CONVERSIONS_IN_CONNECT) qt_internal_add_global_definition(QT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH) diff --git a/src/corelib/global/qttypetraits.h b/src/corelib/global/qttypetraits.h index 49f2728e9f5..1efb24bf70f 100644 --- a/src/corelib/global/qttypetraits.h +++ b/src/corelib/global/qttypetraits.h @@ -24,7 +24,7 @@ constexpr std::underlying_type_t qToUnderlying(Enum e) noexcept return static_cast>(e); } -#ifndef QT_NO_AS_CONST +#ifndef QT_NO_QASCONST #if QT_DEPRECATED_SINCE(6, 6) // this adds const to non-const objects (like std::as_const) @@ -36,7 +36,7 @@ template void qAsConst(const T &&) = delete; #endif // QT_DEPRECATED_SINCE(6, 6) -#endif // QT_NO_AS_CONST +#endif // QT_NO_QASCONST #ifndef QT_NO_QEXCHANGE diff --git a/src/corelib/global/qttypetraits.qdoc b/src/corelib/global/qttypetraits.qdoc index a50b3b9f113..ed814d6f431 100644 --- a/src/corelib/global/qttypetraits.qdoc +++ b/src/corelib/global/qttypetraits.qdoc @@ -54,6 +54,20 @@ To prevent this construct from compiling (and failing at runtime), qAsConst() has a second, deleted, overload which binds to rvalues. + + \note You can make the qAsConst() function unavailable by defining + the \l{QT_NO_QASCONST} macro. +*/ + +/*! + \macro QT_NO_QASCONST + \since 6.8 + \relates + + Defining this macro removes the availability of the qAsConst() + function. + + \sa qAsConst */ /*!