summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetatype.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-07-12 12:19:34 +0200
committerLars Knoll <lars.knoll@qt.io>2020-08-24 00:17:05 +0200
commit73fd7f2efcdb31e33febe840357a9d7b05e89165 (patch)
tree5a2a5756e03892c55856a4275521c1924213e3b9 /src/corelib/kernel/qmetatype.cpp
parenta701b0ed30cda064aea111f18355c8b268c22974 (diff)
Use QMetaTypeModuleHelper as the interface to do type conversions
Move the type conversions from QVariant::Helper to QMetaType. Only do this for Qt Gui in a first step. This makes it possible to completely remove the Handler struct in QVariant, and now allows QMetaType to also convert Gui types. Moving the conversion of Core types into QMetaType will require further work. Change-Id: I061f789deca1b595d92bb29227eb54b8e71a3ee3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qmetatype.cpp')
-rw-r--r--src/corelib/kernel/qmetatype.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index c410c510e6..8d15b4a2aa 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1036,6 +1036,10 @@ bool QMetaType::hasRegisteredDebugStreamOperator() const
*/
bool QMetaType::convert(const void *from, int fromTypeId, void *to, int toTypeId)
{
+ if (auto moduleHelper = qModuleHelperForType(qMax(fromTypeId, toTypeId))) {
+ if (moduleHelper->convert(from, fromTypeId, to, toTypeId))
+ return true;
+ }
const QMetaType::ConverterFunction * const f =
customTypesConversionRegistry()->function(qMakePair(fromTypeId, toTypeId));
return f && (*f)(from, to);