diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2022-07-22 15:26:48 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2022-07-27 12:35:50 -0700 |
commit | 36b4aa111883fcd70c03f2bb8f61c9d22ab0b1aa (patch) | |
tree | 8cd31fdc94d3fbbea14e62e81b4a2ab77c4441a3 /src/corelib/kernel/qvariant.cpp | |
parent | 3da89227feac3ba10275da762726e371617b611f (diff) |
QVariant::Private: replace QMetaType constructor with interface
And move it into the .cpp file, to hide the ugliness.
Change-Id: I3859764fed084846bcb0fffd17044729e361a42e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qvariant.cpp')
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 7310fd9be2..3eba3685d0 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -298,6 +298,12 @@ static QVariant::Private clonePrivate(const QVariant::Private &other) } // anonymous used to hide QVariant handlers +inline QVariant::Private::Private(const QtPrivate::QMetaTypeInterface *iface) noexcept + : is_shared(false), is_null(false), packedType(quintptr(iface) >> 2) +{ + Q_ASSERT((quintptr(iface) & 0x3) == 0); +} + template <typename T> inline QVariant::Private::Private(std::piecewise_construct_t, const T &t) : is_shared(!CanUseInternalSpace<T>), is_null(std::is_same_v<T, std::nullptr_t>) @@ -826,7 +832,7 @@ QVariant::QVariant(const QVariant &p) \sa QVariant::fromValue(), QMetaType::Type */ -QVariant::QVariant(QMetaType type, const void *copy) : d(type) +QVariant::QVariant(QMetaType type, const void *copy) : d(type.iface()) { if (isValidMetaTypeForVariant(type.iface(), copy)) customConstruct(type.iface(), &d, copy); @@ -978,7 +984,7 @@ void QVariant::detach() return; Q_ASSERT(isValidMetaTypeForVariant(d.typeInterface(), constData())); - Private dd(d.type()); + Private dd(d.typeInterface()); customConstruct(d.typeInterface(), &dd, constData()); if (!d.data.shared->ref.deref()) customClear(&d); |