summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qvariant.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel/qvariant.h')
-rw-r--r--src/corelib/kernel/qvariant.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 02458a07e0..9b477e5dd6 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -370,19 +370,21 @@ class Q_CORE_EXPORT QVariant
{ return !cmp(v); }
protected:
- friend inline bool qvariant_cast_helper(const QVariant &, QVariant::Type, void *);
- friend void qRegisterGuiVariant();
- friend void qUnregisterGuiVariant();
friend inline bool operator==(const QVariant &, const QVariantComparisonHelper &);
#ifndef QT_NO_DEBUG_STREAM
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QVariant &);
#endif
Private d;
-
- static const Handler *handler;
-
+#ifndef Q_NO_TEMPLATE_FRIENDS
+ template<typename T>
+ friend inline T qvariant_cast(const QVariant &);
+private:
+#else
+public:
+#endif
void create(int type, const void *copy);
bool cmp(const QVariant &other) const;
+ bool convert(const int t, void *ptr) const;
private:
// force compile error, prevent QVariant(bool) to be called
@@ -396,9 +398,6 @@ public:
inline DataPtr &data_ptr() { return d; }
};
-inline bool qvariant_cast_helper(const QVariant &v, QVariant::Type tp, void *ptr)
-{ return QVariant::handler->convert(&v.d, tp, ptr, 0); }
-
template <typename T>
inline QVariant qVariantFromValue(const T &t)
{
@@ -488,7 +487,7 @@ template<typename T> inline T qvariant_cast(const QVariant &v)
return *reinterpret_cast<const T *>(v.constData());
if (vid < int(QMetaType::User)) {
T t;
- if (qvariant_cast_helper(v, QVariant::Type(vid), &t))
+ if (v.convert(vid, &t))
return t;
}
return T();