diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-16 02:26:39 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-16 02:52:18 (GMT) |
commit | ce28ad22e2e8d7dadea55f89e9ef93f2528d1098 (patch) | |
tree | 54060b690fd45246138de1dbeacd29f24ff859f1 /src/declarative/qml/qmlprivate.h | |
parent | 62c390d3990bd5c65c9710622198e653e8ac9050 (diff) | |
download | Qt-ce28ad22e2e8d7dadea55f89e9ef93f2528d1098.zip Qt-ce28ad22e2e8d7dadea55f89e9ef93f2528d1098.tar.gz Qt-ce28ad22e2e8d7dadea55f89e9ef93f2528d1098.tar.bz2 |
Revert "Compilation fix on MSVC"
This reverts commit 6d28410756ab29277807d2026b4cbd8e1c707714.
Diffstat (limited to 'src/declarative/qml/qmlprivate.h')
-rw-r--r-- | src/declarative/qml/qmlprivate.h | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index 25e60e0..21a1164 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -123,13 +123,43 @@ namespace QmlPrivate } }; - template<typename T, typename Sign = T *(*)(QObject *)> - struct has_qmlAttachedProperties + template <typename T> + class has_attachedPropertiesMember + { + typedef int yes_type; + typedef char no_type; + template <int> + struct Selector {}; + + template <typename S> + static yes_type test(Selector<sizeof(&S::qmlAttachedProperties)>*); + + template <typename S> + static no_type test(...); + + public: + static bool const value = sizeof(test<T>(0)) == sizeof(yes_type); + }; + + template <typename T, bool hasMember> + class has_attachedPropertiesMethod { - template <typename U, U> struct type_check; - template <typename _1> static char check(type_check<Sign, &_1::qmlAttachedProperties> *); - template <typename > static int check(...); - static bool const value = sizeof(check<T>(0)) == sizeof(char); + typedef int yes_type; + typedef char no_type; + + template<typename ReturnType> + static yes_type check(ReturnType *(*)(QObject *)); + static no_type check(...); + + public: + static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); + }; + + template <typename T> + class has_attachedPropertiesMethod<T, false> + { + public: + static bool const value = false; }; template<typename T, int N> @@ -161,13 +191,13 @@ namespace QmlPrivate template<typename T> inline QmlAttachedPropertiesFunc attachedPropertiesFunc() { - return AttachedPropertySelector<T, has_qmlAttachedProperties<T>::value >::func(); + return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func(); } template<typename T> inline const QMetaObject *attachedPropertiesMetaObject() { - return AttachedPropertySelector<T, has_qmlAttachedProperties<T>::value >::metaObject(); + return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject(); } struct MetaTypeIds { |