diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 14 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 8 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt index d8baa4952b..1a9a690f42 100644 --- a/src/corelib/CMakeLists.txt +++ b/src/corelib/CMakeLists.txt @@ -264,6 +264,8 @@ qt_internal_add_module(Core # special case end ) +qt_update_ignore_pch_source(Core kernel/qmetatype.cpp ) + # special case begin add_dependencies(Core qmodule_pri) add_dependencies(Core ${QT_CMAKE_EXPORT_NAMESPACE}::moc) diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 60fe614922..9554a844f1 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -37,7 +37,9 @@ ** ****************************************************************************/ +#define QT_QMETATYPE_BC_COMPAT 1 #include "qmetatype.h" +#undef QT_QMETATYPE_BC_COMPAT #include "qmetatype_p.h" #include "qobjectdefs.h" #include "qdatetime.h" @@ -489,6 +491,18 @@ bool QMetaType::isRegistered() const Returns id type hold by this QMetatype instance. */ +// keep in sync with version in header +// ### Qt 7::remove BC helper +int QMetaType::id() const +{ + if (d_ptr) { + if (int id = d_ptr->typeId.loadRelaxed()) + return id; + return idHelper(); + } + return 0; +} + /*! \internal The slowpath of id(). Precondition: d_ptr != nullptr diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index fe68a15e5a..c08a87efd9 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -444,7 +444,12 @@ public: bool isValid() const; bool isRegistered() const; - int id() const +#if defined(QT_QMETATYPE_BC_COMPAT) + int id() const; +#else + // ### Qt 7: Remove traces of out of line version + // unused int parameter is used to avoid ODR violation + int id(int = 0) const { if (d_ptr) { if (int id = d_ptr->typeId.loadRelaxed()) @@ -453,6 +458,7 @@ public: } return 0; }; +#endif constexpr qsizetype sizeOf() const; constexpr qsizetype alignOf() const; constexpr TypeFlags flags() const; |