Use QTypeInfo<T>::isRelocatable in QVariant

Change-Id: Ib306f8f647014b399b87ffff13f1f01c40dc3ef7
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2015-07-17 21:29:20 -07:00
parent 90ef875785
commit 3bcb3c64e2
3 changed files with 5 additions and 5 deletions

View File

@ -1627,7 +1627,7 @@ namespace QtPrivate {
template<typename T>
struct QMetaTypeTypeFlags
{
enum { Flags = (!QTypeInfo<T>::isStatic ? QMetaType::MovableType : 0)
enum { Flags = (QTypeInfoQuery<T>::isRelocatable ? QMetaType::MovableType : 0)
| (QTypeInfo<T>::isComplex ? QMetaType::NeedsConstruction : 0)
| (QTypeInfo<T>::isComplex ? QMetaType::NeedsDestruction : 0)
| (IsPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::PointerToQObject : 0)

View File

@ -58,7 +58,7 @@ template<typename T>
struct QVariantIntegrator
{
static const bool CanUseInternalSpace = sizeof(T) <= sizeof(QVariant::Private::Data)
&& ((!QTypeInfo<T>::isStatic) || Q_IS_ENUM(T));
&& ((QTypeInfoQuery<T>::isRelocatable) || Q_IS_ENUM(T));
};
Q_STATIC_ASSERT(QVariantIntegrator<double>::CanUseInternalSpace);
Q_STATIC_ASSERT(QVariantIntegrator<long int>::CanUseInternalSpace);

View File

@ -972,7 +972,7 @@ QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW)
QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false << false;
QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false << false;
QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false << false;
QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << false << true << false << true;
QTest::newRow("FlagsDataEnum") << ::qMetaTypeId<FlagsDataEnum>() << true << true << false << true;
// invalid ids.
QTest::newRow("-1") << -1 << false << false << false << false;
@ -1052,9 +1052,9 @@ void tst_QMetaType::flagsBinaryCompatibility5_0()
QFETCH(quint32, id);
QFETCH(quint32, flags);
quint32 mask_5_0 = 0x1ff; // Only compare the values that were already defined in 5.0
quint32 mask_5_0 = 0x1fb; // Only compare the values that were already defined in 5.0
QCOMPARE(quint32(QMetaType::typeFlags(id)) & mask_5_0, flags);
QCOMPARE(quint32(QMetaType::typeFlags(id)) & mask_5_0, flags & mask_5_0);
}
void tst_QMetaType::construct_data()