diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-03-12 18:45:54 +0100 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-03-12 18:21:50 +0000 |
commit | b19eafb2ca596931431a0b27e3ac59d263e40cc0 (patch) | |
tree | 9a651ad8eaffe0d408a3d83b022ac9108521e092 /src/qml/qml/qqmlvaluetype.cpp | |
parent | cd5ca0a582dda5e49d97e5db6b2b64b30e5553bd (diff) |
Acknowledge QPersistentModelIndex is a built-in meta-type
We remove the now unnecessary meta-type registration and
conversions for QPersistenModelIndex.
This reverts and amends commit 7b29a983fa794291ff8ec.
Change-Id: I4e8346bb7ab03766e1dd5c2c23bb6cf47ab1f455
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/qml/qml/qqmlvaluetype.cpp')
-rw-r--r-- | src/qml/qml/qqmlvaluetype.cpp | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp index d3142af75e..2b3f78b676 100644 --- a/src/qml/qml/qqmlvaluetype.cpp +++ b/src/qml/qml/qqmlvaluetype.cpp @@ -58,30 +58,6 @@ struct QQmlValueTypeFactoryImpl QMutex mutex; }; - -namespace { -// This should be removed once the QPersistentModelIndex as built-in type is merged in qtbase -#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) -#error Please, someone remove this. QPersistentModelIndex should be a built-in meta-type by now. -#else -template <typename T, bool builtin = QMetaTypeId2<T>::IsBuiltIn> -struct QPMIConvertersRegistrer { - void registerConverters() - { - } -}; - -template <typename T> struct QPMIConvertersRegistrer<T, false> { - void registerConverters() - { - qRegisterMetaType<QPersistentModelIndex>(); - QMetaType::registerConverter<QModelIndex, QPersistentModelIndex>(&QQmlModelIndexValueType::toPersistentModelIndex); - QMetaType::registerConverter<QPersistentModelIndex, QModelIndex>(&QQmlPersistentModelIndexValueType::toModelIndex); - } -}; -#endif -} - QQmlValueTypeFactoryImpl::QQmlValueTypeFactoryImpl() { for (unsigned int ii = 0; ii < QVariant::UserType; ++ii) @@ -91,9 +67,6 @@ QQmlValueTypeFactoryImpl::QQmlValueTypeFactoryImpl() qRegisterMetaType<QModelIndexList>(); qRegisterMetaType<QItemSelectionRange>(); qRegisterMetaType<QItemSelection>(); - - QPMIConvertersRegistrer<QPersistentModelIndex> conv; - conv.registerConverters(); } QQmlValueTypeFactoryImpl::~QQmlValueTypeFactoryImpl() @@ -136,15 +109,15 @@ const QMetaObject *QQmlValueTypeFactoryImpl::metaObjectForMetaType(int t) return &QQmlEasingValueType::staticMetaObject; case QVariant::ModelIndex: return &QQmlModelIndexValueType::staticMetaObject; + case QVariant::PersistentModelIndex: + return &QQmlPersistentModelIndexValueType::staticMetaObject; default: if (const QMetaObject *mo = QQml_valueTypeProvider()->metaObjectForMetaType(t)) return mo; break; } - if (t == qMetaTypeId<QPersistentModelIndex>()) - return &QQmlPersistentModelIndexValueType::staticMetaObject; - else if (t == qMetaTypeId<QModelIndexList>()) + if (t == qMetaTypeId<QModelIndexList>()) return &QQmlModelIndexListValueType::staticMetaObject; else if (t == qMetaTypeId<QItemSelectionRange>()) return &QQmlItemSelectionRangeValueType::staticMetaObject; |