diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-11-22 15:10:42 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-23 10:03:40 +0100 |
commit | 384fd7cdf1cb3061126c74c4f591cd2c0acdfedc (patch) | |
tree | 3ca056562d4fc9e12a8c982f7f4956ddba556d8c /src/declarative/qml/v4 | |
parent | 23a6a1c26b3206a53f8b3019c3a7dcff8a623a24 (diff) |
v4: Get rid of dependency on QQuickAnchorLine type
Delegate the meta-type id query and value comparison to
QDeclarativeMetaType.
Register a comparison function for QQuickAnchorLine in
QQuickItemsModule, so that not even QDeclarativeMetaType needs to
know the type declaration. (This is needed in order to be able to
move the items to a separate library.)
Change-Id: I6404d01b74143946ae0a79fa18d1777b675e4194
Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/declarative/qml/v4')
-rw-r--r-- | src/declarative/qml/v4/qv4bindings.cpp | 13 | ||||
-rw-r--r-- | src/declarative/qml/v4/qv4compiler.cpp | 5 | ||||
-rw-r--r-- | src/declarative/qml/v4/qv4irbuilder.cpp | 4 |
3 files changed, 9 insertions, 13 deletions
diff --git a/src/declarative/qml/v4/qv4bindings.cpp b/src/declarative/qml/v4/qv4bindings.cpp index 1f9342723e..835b7e7752 100644 --- a/src/declarative/qml/v4/qv4bindings.cpp +++ b/src/declarative/qml/v4/qv4bindings.cpp @@ -48,7 +48,7 @@ #include <private/qdeclarativefastproperties_p.h> #include <private/qdeclarativedebugtrace_p.h> -#include <private/qquickanchors_p_p.h> // For AnchorLine +#include <private/qdeclarativemetatype_p.h> #include <QtDeclarative/qdeclarativeinfo.h> #include <QtCore/qnumeric.h> @@ -450,11 +450,8 @@ static bool testCompareVariants(const QVariant &qtscriptRaw, const QVariant &v4) QDeclarative1AnchorLine ra = qvariant_cast<QDeclarative1AnchorLine>(v4); return la == ra; - } else if (type == qMetaTypeId<QQuickAnchorLine>()) { - QQuickAnchorLine la = qvariant_cast<QQuickAnchorLine>(qtscript); - QQuickAnchorLine ra = qvariant_cast<QQuickAnchorLine>(v4); - - return la == ra; + } else if (type == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId()) { + return QDeclarativeMetaType::QQuickAnchorLineCompare(qtscript.constData(), v4.constData()); } else if (type == QMetaType::Double) { double la = qvariant_cast<double>(qtscript); @@ -535,8 +532,8 @@ static void testBindingResult(const QString &binding, int line, int column, default: if (resultType == qMetaTypeId<QDeclarative1AnchorLine>()) { v4value = qVariantFromValue<QDeclarative1AnchorLine>(*(QDeclarative1AnchorLine *)result.typeDataPtr()); - } else if (resultType == qMetaTypeId<QQuickAnchorLine>()) { - v4value = qVariantFromValue<QQuickAnchorLine>(*(QQuickAnchorLine *)result.typeDataPtr()); + } else if (resultType == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId()) { + v4value = QVariant(QDeclarativeMetaType::QQuickAnchorLineMetaTypeId(), result.typeDataPtr()); } else { iserror = true; v4Result = "Unknown V4 type"; diff --git a/src/declarative/qml/v4/qv4compiler.cpp b/src/declarative/qml/v4/qv4compiler.cpp index 8fdfa74ac4..1d6cd30a99 100644 --- a/src/declarative/qml/v4/qv4compiler.cpp +++ b/src/declarative/qml/v4/qv4compiler.cpp @@ -48,7 +48,6 @@ #include <private/qdeclarativejsast_p.h> #include <private/qdeclarativefastproperties_p.h> #include <private/qdeclarativejsengine_p.h> -#include <private/qquickanchors_p_p.h> // For AnchorLine QT_BEGIN_NAMESPACE @@ -346,7 +345,7 @@ void QV4CompilerPrivate::visitName(IR::Name *e) default: if (propTy == qMetaTypeId<QDeclarative1AnchorLine>()) { regType = PODValueType; - } else if (propTy == qMetaTypeId<QQuickAnchorLine>()) { + } else if (propTy == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId()) { regType = PODValueType; } else if (QDeclarativeMetaType::isQObject(propTy)) { regType = QObjectStarType; @@ -945,7 +944,7 @@ void QV4CompilerPrivate::visitRet(IR::Ret *s) test.regType = qMetaTypeId<QDeclarative1AnchorLine>(); break; case IR::SGAnchorLineType: - test.regType = qMetaTypeId<QQuickAnchorLine>(); + test.regType = QDeclarativeMetaType::QQuickAnchorLineMetaTypeId(); break; case IR::ObjectType: test.regType = QMetaType::QObjectStar; diff --git a/src/declarative/qml/v4/qv4irbuilder.cpp b/src/declarative/qml/v4/qv4irbuilder.cpp index 125e1d002a..c65b348c9f 100644 --- a/src/declarative/qml/v4/qv4irbuilder.cpp +++ b/src/declarative/qml/v4/qv4irbuilder.cpp @@ -42,7 +42,7 @@ #include "qv4irbuilder_p.h" #include "qv4compiler_p_p.h" -#include <private/qquickanchors_p_p.h> // For AnchorLine +#include <private/qdeclarativemetatype_p.h> #include <private/qdeclarativetypenamecache_p.h> DEFINE_BOOL_CONFIG_OPTION(qmlVerboseCompiler, QML_VERBOSE_COMPILER) @@ -72,7 +72,7 @@ static IR::Type irTypeFromVariantType(int t, QDeclarativeEnginePrivate *engine, default: if (t == qMetaTypeId<QDeclarative1AnchorLine>()) return IR::AnchorLineType; - else if (t == qMetaTypeId<QQuickAnchorLine>()) + else if (t == QDeclarativeMetaType::QQuickAnchorLineMetaTypeId()) return IR::SGAnchorLineType; else if (engine->metaObjectForType(t)) { return IR::ObjectType; |