diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-05 11:05:24 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-05 12:03:40 (GMT) |
commit | 4acabb3abd0ff109b9abeedb6832f5b1c3e0cc4e (patch) | |
tree | 76b183192356a216f9084a938d7f3a87a1f4e262 /src/corelib/kernel/qmetaobject.cpp | |
parent | f101435831bb06f342bb0e2241e3011073341617 (diff) | |
download | Qt-4acabb3abd0ff109b9abeedb6832f5b1c3e0cc4e.zip Qt-4acabb3abd0ff109b9abeedb6832f5b1c3e0cc4e.tar.gz Qt-4acabb3abd0ff109b9abeedb6832f5b1c3e0cc4e.tar.bz2 |
handle qreal properties correctly in the meta-object system
When cross-compiling, it's possible that the size of qreal for moc
itself (host platform) is different from the size of qreal on the target
platform. Thus, we should not encode the metatype-id of qreal at moc
time. Instead, use QMetaType::QReal in the generated code so that the
the property flags are only derived at compile time.
We also need to support the pesky QT_COORD_TYPE. In this case, qreal can
be _any_ type (not just float or double), so we encode the property type
as 0 and have a special check in QMetaProperty::type() that resolves the
correct type at runtime.
Reviewed-by: Simon Hausmann
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index b65f956..6f3316c 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2003,6 +2003,11 @@ QVariant::Type QMetaProperty::type() const if (enumMetaTypeId == 0) return QVariant::Int; } +#ifdef QT_COORD_TYPE + // qreal metatype must be resolved at runtime. + if (strcmp(typeName(), "qreal") == 0) + return QVariant::Type(qMetaTypeId<qreal>()); +#endif return QVariant::UserType; } |