summaryrefslogtreecommitdiffstats
path: root/src/corelib/compat/removed_api.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-07-19 12:31:07 -0700
committerThiago Macieira <thiago.macieira@intel.com>2022-07-26 20:12:30 -0700
commit74fac865cf7c55d3afba1043072ba6cc932d161d (patch)
tree4bb096785a07fb5986c2b1311de66fbd1a32c349 /src/corelib/compat/removed_api.cpp
parentb1d9331c156b7ff5c724600eee21ac50f4565868 (diff)
QMetaType: add registerType() and qRegisterMetaType(QMetaType)
This also rewrites QMetaType::id() on top of the helper, with the benefit of calling a member static function, so QMetaType doesn't need to be spilled onto the stack. In some upcoming changes I need to ensure that QMetaTypes are registered so they can be found by name and I'd like to have a dedicated function name for that, instead of calling .id(). Since I needed to add docs for the new function, I've updated for the old one too. [ChangeLog][QMetaType] Added QMetaType::registerType() and an overload of qRegisterMetaType() taking QMetaType (the two functions do the same thing). These two functions ensure a given QMetaType is registered with the Qt global registry, so they can be found by name later. Using qRegisterMetaType<T>() also accomplishes the same thing, but is slightly better for completely generic code because it will avoid emitting the registration for built-in types. Change-Id: I3859764fed084846bcb0fffd170351d606034c22 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/compat/removed_api.cpp')
-rw-r--r--src/corelib/compat/removed_api.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp
index c4fe85f84f..7ffefa027e 100644
--- a/src/corelib/compat/removed_api.cpp
+++ b/src/corelib/compat/removed_api.cpp
@@ -283,6 +283,14 @@ QT_WARNING_POP
#if QT_CORE_REMOVED_SINCE(6, 5)
+#include "qmetatype.h"
+
+int QMetaType::idHelper() const
+{
+ Q_ASSERT(d_ptr);
+ return registerHelper(d_ptr);
+}
+
#include "qxmlstream.h"
QXmlStreamReader::QXmlStreamReader(const QByteArray &data)