summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-03-04 04:49:20 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-03-04 04:49:20 (GMT)
commiteda079761194a96783cdb8d49c79eb2c9c0b7dac (patch)
tree4ca35b23b09e6c3d1d2fb11ec943c9347bb5719b /src
parent4164a11032b64fe5a557515f283fa0e4c6d0260d (diff)
downloadQt-eda079761194a96783cdb8d49c79eb2c9c0b7dac.zip
Qt-eda079761194a96783cdb8d49c79eb2c9c0b7dac.tar.gz
Qt-eda079761194a96783cdb8d49c79eb2c9c0b7dac.tar.bz2
Compile without QVariant::EasingCurve in Qt 4.6.2.
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativecompiler.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp4
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp2
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp6
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp41
-rw-r--r--src/declarative/qml/qdeclarativevaluetype_p.h9
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp8
7 files changed, 61 insertions, 11 deletions
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index 1eea012..b07a85a 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -1792,7 +1792,7 @@ bool QDeclarativeCompiler::buildGroupedProperty(QDeclarativeParser::Property *pr
if (prop->values.count())
COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QDeclarativeCompiler", "Invalid value in grouped property"));
- if (prop->type < (int)QVariant::UserType) {
+ if (QDeclarativeValueTypeFactory::isValueType(prop->type)) {
QDeclarativeEnginePrivate *ep =
static_cast<QDeclarativeEnginePrivate *>(QObjectPrivate::get(engine));
if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) {
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 09882cb..3e4acbe 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -117,7 +117,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx)
QVariant value = prop.read(obj);
rv.value = valueContents(value);
- if (QVariant::Type(prop.userType()) < QVariant::UserType) {
+ if (QDeclarativeValueTypeFactory::isValueType(prop.userType())) {
rv.type = QDeclarativeObjectProperty::Basic;
} else if (QDeclarativeMetaType::isQObject(prop.userType())) {
rv.type = QDeclarativeObjectProperty::Object;
@@ -131,7 +131,7 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx)
QVariant QDeclarativeEngineDebugServer::valueContents(const QVariant &value) const
{
int userType = value.userType();
- if (QVariant::Type(userType) < QVariant::UserType)
+ if (QDeclarativeValueTypeFactory::isValueType(userType))
return value;
/*
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 542f417..2e4ffa7 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -232,7 +232,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name)
QDeclarativeEnginePrivate::CapturedProperty(obj, lastData->coreIndex, lastData->notifyIndex);
}
- if ((uint)lastData->propType < QVariant::UserType) {
+ if (QDeclarativeValueTypeFactory::isValueType((uint)lastData->propType)) {
QDeclarativeValueType *valueType = enginePriv->valueTypes[lastData->propType];
if (valueType)
return Value(scriptEngine, enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType));
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index 521c241..4f73b89 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -238,10 +238,10 @@ void QDeclarativePropertyPrivate::initProperty(QObject *obj, const QString &name
if (property->flags & QDeclarativePropertyCache::Data::IsFunction)
return; // Not an object property
- if (ii == (path.count() - 2) && property->propType < (int)QVariant::UserType) {
+ if (ii == (path.count() - 2) && QDeclarativeValueTypeFactory::isValueType(property->propType)) {
// We're now at a value type property. We can use a global valuetypes array as we
// never actually use the objects, just look up their properties.
- QObject *typeObject = qmlValueTypes()->valueTypes[property->propType];
+ QObject *typeObject = (*qmlValueTypes())[property->propType];
if (!typeObject) return; // Not a value type
int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData());
@@ -346,7 +346,7 @@ QDeclarativePropertyPrivate::propertyTypeCategory() const
int type = propertyType();
if (type == QVariant::Invalid)
return QDeclarativeProperty::InvalidCategory;
- else if ((uint)type < QVariant::UserType)
+ else if (QDeclarativeValueTypeFactory::isValueType((uint)type))
return QDeclarativeProperty::Normal;
else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived)
return QDeclarativeProperty::Object;
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index 01fa214..34d3795 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -45,19 +45,50 @@
QT_BEGIN_NAMESPACE
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+Q_DECLARE_METATYPE(QEasingCurve);
+#endif
+
QDeclarativeValueTypeFactory::QDeclarativeValueTypeFactory()
{
// ### Optimize
for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
valueTypes[ii] = valueType(ii);
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+ easingType = qMetaTypeId<QEasingCurve>();
+ easingValueType = valueType(easingType);
+#endif
}
QDeclarativeValueTypeFactory::~QDeclarativeValueTypeFactory()
{
for (unsigned int ii = 0; ii < (QVariant::UserType - 1); ++ii)
delete valueTypes[ii];
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+ delete easingValueType;
+#endif
+}
+
+bool QDeclarativeValueTypeFactory::isValueType(int idx)
+{
+ if ((uint)idx < QVariant::UserType)
+ return true;
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+ if (idx == qMetaTypeId<QEasingCurve>())
+ return true;
+#endif
+ return false;
}
+QDeclarativeValueType *QDeclarativeValueTypeFactory::operator[](int idx) const
+{
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+ if (idx == easingType) return easingValueType;
+#endif
+ return valueTypes[idx];
+}
+
+
QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
{
switch (t) {
@@ -75,11 +106,17 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
return new QDeclarativeRectFValueType;
case QVariant::Vector3D:
return new QDeclarativeVector3DValueType;
+#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
case QVariant::EasingCurve:
return new QDeclarativeEasingValueType;
+#endif
case QVariant::Font:
return new QDeclarativeFontValueType;
default:
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+ if (t == qMetaTypeId<QEasingCurve>())
+ return new QDeclarativeEasingValueType;
+#endif
return 0;
}
}
@@ -495,7 +532,11 @@ void QDeclarativeEasingValueType::write(QObject *obj, int idx, QDeclarativePrope
QVariant QDeclarativeEasingValueType::value()
{
+#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0))
return QVariant(easing);
+#else
+ return QVariant::fromValue<QEasingCurve>(easing);
+#endif
}
void QDeclarativeEasingValueType::setValue(QVariant value)
diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h
index cb153be..e69f161 100644
--- a/src/declarative/qml/qdeclarativevaluetype_p.h
+++ b/src/declarative/qml/qdeclarativevaluetype_p.h
@@ -81,10 +81,17 @@ class Q_DECLARATIVE_EXPORT QDeclarativeValueTypeFactory
public:
QDeclarativeValueTypeFactory();
~QDeclarativeValueTypeFactory();
+ static bool isValueType(int);
static QDeclarativeValueType *valueType(int);
+ QDeclarativeValueType *operator[](int idx) const;
+
+private:
QDeclarativeValueType *valueTypes[QVariant::UserType - 1];
- QDeclarativeValueType *operator[](int idx) const { return valueTypes[idx]; }
+#if (QT_VERSION < QT_VERSION_CHECK(4,7,0))
+ int easingType;
+ QDeclarativeValueType *easingValueType;
+#endif
};
class Q_AUTOTEST_EXPORT QDeclarativePointFValueType : public QDeclarativeValueType
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index b14de19..f33d7c7 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -52,6 +52,7 @@
#include <qdeclarativestringconverters_p.h>
#include <qdeclarativeglobal_p.h>
#include <qdeclarativemetatype_p.h>
+#include <qdeclarativevaluetype_p.h>
#include <qdeclarativeproperty_p.h>
#include <qvariant.h>
@@ -1710,12 +1711,13 @@ void QDeclarativePropertyAnimationPrivate::convertVariant(QVariant &variant, int
break;
}
default:
- if ((uint)type >= QVariant::UserType) {
+ if (QDeclarativeValueTypeFactory::isValueType((uint)type)) {
+ variant.convert((QVariant::Type)type);
+ } else {
QDeclarativeMetaType::StringConverter converter = QDeclarativeMetaType::customStringConverter(type);
if (converter)
variant = converter(variant.toString());
- } else
- variant.convert((QVariant::Type)type);
+ }
break;
}
}