static void customConstruct(QVariant::Private *d, const void *copy)
{
- const uint size = QMetaType::sizeOf(d->type);
+ const QMetaType type(d->type);
+ const uint size = type.sizeOf();
if (!size) {
d->type = QVariant::Invalid;
return;
// this logic should match with QVariantIntegrator::CanUseInternalSpace
if (size <= sizeof(QVariant::Private::Data)
- && (QMetaType::typeFlags(d->type) & QMetaType::MovableType)) {
- QMetaType::construct(d->type, &d->data.ptr, copy);
+ && (type.flags() & QMetaType::MovableType)) {
+ type.construct(&d->data.ptr, copy);
d->is_shared = false;
} else {
- void *ptr = QMetaType::create(d->type, copy);
+ void *ptr = type.create(copy);
d->is_shared = true;
d->data.shared = new QVariant::PrivateShared(ptr);
}
double n,i,e,r,o,b;
};
Q_STATIC_ASSERT(sizeof(BigClass) > sizeof(QVariant::Private::Data));
+Q_DECLARE_TYPEINFO(BigClass, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(BigClass);
struct SmallClass
char s;
};
Q_STATIC_ASSERT(sizeof(SmallClass) <= sizeof(QVariant::Private::Data));
+Q_DECLARE_TYPEINFO(SmallClass, Q_MOVABLE_TYPE);
Q_DECLARE_METATYPE(SmallClass);
void tst_qvariant::testBound()