diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-01-10 14:46:34 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-11 19:32:34 +0100 |
commit | 0fd8816340dab1fa12128ad8d20815472db10a95 (patch) | |
tree | cc38e018e062af2646862fae9beb907d588ba7a2 /src/corelib/kernel | |
parent | a7f4139af02d0ace2c0a408668a51505f1f964e4 (diff) |
Add QModelIndex as a built-in metatype.
Change-Id: Ib87cfff8b4baee78189f3df5e20d2e1a00d690e1
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 15 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 5 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 1 |
4 files changed, 23 insertions, 1 deletions
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 112dfe92e6..375c7b75bb 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -62,6 +62,7 @@ # include "qbitarray.h" # include "qurl.h" # include "qvariant.h" +# include "qabstractitemmodel.h" #endif #ifndef QT_NO_GEOM_VARIANT @@ -108,6 +109,7 @@ template<> struct TypeDefiniton<QVariant> { static const bool IsAvailable = fals template<> struct TypeDefiniton<QBitArray> { static const bool IsAvailable = false; }; template<> struct TypeDefiniton<QUrl> { static const bool IsAvailable = false; }; template<> struct TypeDefiniton<QEasingCurve> { static const bool IsAvailable = false; }; +template<> struct TypeDefiniton<QModelIndex> { static const bool IsAvailable = false; }; #endif #ifdef QT_NO_REGEXP template<> struct TypeDefiniton<QRegExp> { static const bool IsAvailable = false; }; @@ -1124,6 +1126,10 @@ void *QMetaType::create(int type, const void *copy) #endif case QMetaType::QUuid: return new NS(QUuid)(*static_cast<const NS(QUuid)*>(copy)); +#ifndef QT_BOOTSTRAPPED + case QMetaType::QModelIndex: + return new NS(QModelIndex)(*static_cast<const NS(QModelIndex)*>(copy)); +#endif case QMetaType::Void: return 0; default: @@ -1223,6 +1229,10 @@ void *QMetaType::create(int type, const void *copy) #endif case QMetaType::QUuid: return new NS(QUuid); +#ifndef QT_BOOTSTRAPPED + case QMetaType::QModelIndex: + return new NS(QModelIndex); +#endif case QMetaType::Void: return 0; default: @@ -1393,6 +1403,11 @@ void QMetaType::destroy(int type, void *data) case QMetaType::QUuid: delete static_cast< NS(QUuid)* >(data); break; +#ifndef QT_BOOTSTRAPPED + case QMetaType::QModelIndex: + delete static_cast< NS(QModelIndex)* >(data); + break; +#endif case QMetaType::Void: break; default: { diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index ab0203e5e4..843044eee6 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -99,6 +99,7 @@ QT_MODULE(Core) F(QRegExp, 27, QRegExp) \ F(QEasingCurve, 29, QEasingCurve) \ F(QUuid, 30, QUuid) \ + F(QModelIndex, 31, QModelIndex) \ F(QVariant, 138, QVariant) \ #define QT_FOR_EACH_STATIC_CORE_POINTER(F)\ @@ -183,7 +184,7 @@ public: // these are merged with QVariant QT_FOR_EACH_STATIC_TYPE(QT_DEFINE_METATYPE_ID) - LastCoreType = QUuid, + LastCoreType = QModelIndex, FirstGuiType = QFont, LastGuiType = QPolygonF, FirstWidgetsType = QIcon, diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index e4894eccdf..72229c0e63 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -53,6 +53,9 @@ #include "qurl.h" #include "qlocale.h" #include "quuid.h" +#ifndef QT_BOOTSTRAPPED +#include "qabstractitemmodel.h" +#endif #include "private/qvariant_p.h" #include "qmetatype_p.h" @@ -102,6 +105,7 @@ struct TypeDefiniton { // Ignore these types, as incomplete #ifdef QT_BOOTSTRAPPED template<> struct TypeDefiniton<QEasingCurve> { static const bool IsAvailable = false; }; +template<> struct TypeDefiniton<QModelIndex> { static const bool IsAvailable = false; }; #endif #ifdef QT_NO_GEOM_VARIANT template<> struct TypeDefiniton<QRect> { static const bool IsAvailable = false; }; @@ -995,6 +999,7 @@ Q_CORE_EXPORT void QVariantPrivate::unregisterHandler(const int /* Modules::Name \value Double a double \value EasingCurve a QEasingCurve \value Uuid a QUuid + \value ModelIndex a QModelIndex \value Font a QFont \value Hash a QVariantHash \value Icon a QIcon diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 738e516b82..35c584fa51 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -124,6 +124,7 @@ class Q_CORE_EXPORT QVariant Hash = QMetaType::QVariantHash, EasingCurve = QMetaType::QEasingCurve, Uuid = QMetaType::QUuid, + ModelIndex = QMetaType::QModelIndex, LastCoreType = QMetaType::LastCoreType, Font = QMetaType::QFont, |