diff options
-rw-r--r-- | .qmake.conf | 2 | ||||
-rw-r--r-- | src/declarative/qml/parser/qdeclarativejs.g | 2 | ||||
-rw-r--r-- | src/declarative/qml/parser/qdeclarativejsparser_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativecompiler.cpp | 44 | ||||
-rw-r--r-- | src/doc/src/declarative/qtdeclarative.qdoc | 5 | ||||
-rw-r--r-- | sync.profile | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 60 |
9 files changed, 71 insertions, 52 deletions
diff --git a/.qmake.conf b/.qmake.conf index 89914d20..4baafa83 100644 --- a/.qmake.conf +++ b/.qmake.conf @@ -1,4 +1,4 @@ load(qt_build_config) CONFIG += qt_example_installs -MODULE_VERSION = 5.1.2 +MODULE_VERSION = 5.2.0 diff --git a/src/declarative/qml/parser/qdeclarativejs.g b/src/declarative/qml/parser/qdeclarativejs.g index dc466aec..e709bba5 100644 --- a/src/declarative/qml/parser/qdeclarativejs.g +++ b/src/declarative/qml/parser/qdeclarativejs.g @@ -316,7 +316,7 @@ public: inline DiagnosticMessage diagnosticMessage() const { foreach (const DiagnosticMessage &d, diagnostic_messages) { - if (! d.kind == DiagnosticMessage::Warning) + if (d.kind != DiagnosticMessage::Warning) return d; } diff --git a/src/declarative/qml/parser/qdeclarativejsparser_p.h b/src/declarative/qml/parser/qdeclarativejsparser_p.h index 374c11ca..96c01b0f 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser_p.h +++ b/src/declarative/qml/parser/qdeclarativejsparser_p.h @@ -179,7 +179,7 @@ public: inline DiagnosticMessage diagnosticMessage() const { foreach (const DiagnosticMessage &d, diagnostic_messages) { - if (! d.kind == DiagnosticMessage::Warning) + if (d.kind != DiagnosticMessage::Warning) return d; } diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp index 6734e0b4..d0c6517c 100644 --- a/src/declarative/qml/qdeclarativecompiler.cpp +++ b/src/declarative/qml/qdeclarativecompiler.cpp @@ -326,10 +326,14 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop, instr.line = v->location.start.line; if (prop.isEnumType()) { int value; - if (prop.isFlagType()) { - value = prop.enumerator().keysToValue(string.toUtf8().constData()); - } else - value = prop.enumerator().keyToValue(string.toUtf8().constData()); + if (v->value.isNumber()) { //Number saved from earlier check - not valid in testLiteralAssignment + value = v->value.asNumber(); + } else { + if (prop.isFlagType()) + value = prop.enumerator().keysToValue(string.toUtf8().constData()); + else + value = prop.enumerator().keyToValue(string.toUtf8().constData()); + } instr.type = QDeclarativeInstruction::StoreInteger; instr.storeInteger.propertyIndex = prop.propertyIndex(); @@ -2203,6 +2207,12 @@ bool QDeclarativeCompiler::buildPropertyLiteralAssignment(QDeclarativeParser::Pr return true; } +struct StaticQtMetaObject : public QObject +{ + static const QMetaObject *get() + { return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; } +}; + bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop, QDeclarativeParser::Object *obj, QDeclarativeParser::Value *v, @@ -2235,20 +2245,32 @@ bool QDeclarativeCompiler::testQualifiedEnumAssignment(const QMetaProperty &prop objTypeName = objType->qmlTypeName(); } - if (!type || objTypeName != type->qmlTypeName()) + if (!type && typeName != QLatin1String("Qt")) return true; QString enumValue = parts.at(1); - int value; - if (prop.isFlagType()) { - value = prop.enumerator().keysToValue(enumValue.toUtf8().constData()); - } else - value = prop.enumerator().keyToValue(enumValue.toUtf8().constData()); + int value = -1; + + if (type && objTypeName == type->qmlTypeName()) { + if (prop.isFlagType()) { + value = prop.enumerator().keysToValue(enumValue.toUtf8().constData()); + } else { + value = prop.enumerator().keyToValue(enumValue.toUtf8().constData()); + } + } else { + QByteArray enumName = enumValue.toUtf8(); + //Special case for Qt object + const QMetaObject *metaObject = type ? type->metaObject() : StaticQtMetaObject::get(); + for (int ii = metaObject->enumeratorCount() - 1; value == -1 && ii >= 0; --ii) { + QMetaEnum e = metaObject->enumerator(ii); + value = e.keyToValue(enumName.constData()); + } + } if (value == -1) return true; v->type = Value::Literal; - v->value = QDeclarativeParser::Variant(enumValue); + v->value = QDeclarativeParser::Variant((double)value); *isAssignment = true; return true; diff --git a/src/doc/src/declarative/qtdeclarative.qdoc b/src/doc/src/declarative/qtdeclarative.qdoc index 69b15821..8b31f659 100644 --- a/src/doc/src/declarative/qtdeclarative.qdoc +++ b/src/doc/src/declarative/qtdeclarative.qdoc @@ -29,6 +29,7 @@ \module QtDeclarative \title Qt Declarative Module \ingroup modules + \qtvariable declarative \brief The Qt Declarative module provides a declarative framework for building highly dynamic, custom user interfaces. @@ -67,7 +68,7 @@ Declares additional properties of the given \a Type as described by the specified \a Flags. - + Current the only supported type info is \c QML_HAS_ATTACHED_PROPERTIES which declares that the \a Type supports \l {Attached Properties}. @@ -112,7 +113,7 @@ qmlRegisterType<MySliderItem>("com.mycompany.qmlcomponents", 1, 0, "Slider"); \endcode - Once this is registered, the type can be used in QML by importing the + Once this is registered, the type can be used in QML by importing the specified module name and version number: \qml diff --git a/sync.profile b/sync.profile index 92f02601..0db6af93 100644 --- a/sync.profile +++ b/sync.profile @@ -13,7 +13,6 @@ "qtscript" => "", "qtxmlpatterns" => "", "qtdeclarative" => "", - "qtjsbackend" => "", "qtactiveqt" => "", "qttools" => "", "qtwebkit" => "", diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index d0c60043..2b099ad1 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -327,10 +327,7 @@ void tst_qdeclarativeimage::mirror() p_e.drawPixmap(QRect(0, 0, width, height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height())); break; case QDeclarativeImage::PreserveAspectFit: -#if defined(UBUNTU_LUCID) - QEXPECT_FAIL("", "QTBUG-26787", Continue); -#endif - p_e.drawPixmap(QRect(25, 0, width / (width/height), height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height())); + p_e.drawPixmap(QRect(25, 0, height, height), srcPixmap, QRect(0, 0, srcPixmap.width(), srcPixmap.height())); break; case QDeclarativeImage::PreserveAspectCrop: { diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 200c16c2..bdf86641 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -982,7 +982,7 @@ void tst_qdeclarativelistmodel::property_changes() expr.setExpression(script_change); expr.evaluate(); - QVERIFY2(!expr.hasError(), QTest::toString(expr.error())); + QVERIFY2(!expr.hasError(), QTest::toString(expr.error().toString())); // test the object returned by get() emits the correct signals QCOMPARE(connectionsObject->property("gotSignal").toBool(), itemsChanged); diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 8815dbfb..bde7eba5 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -395,34 +395,34 @@ void tst_QDeclarativePathView::insertModel_data() // We have 8 items, with currentIndex == 4 QTest::newRow("insert after current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 6 << 1 << 5. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 6 << 1 << qreal(5.) << 4; QTest::newRow("insert before current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 1 << 4. << 5; + << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 1 << qreal(4.) << 5; QTest::newRow("insert multiple after current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 2 << 6. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 2 << qreal(6.) << 4; QTest::newRow("insert multiple before current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 1 << 2 << 4. << 6; + << int(QDeclarativePathView::StrictlyEnforceRange) << 1 << 2 << qreal(4.) << 6; QTest::newRow("insert at end") - << int(QDeclarativePathView::StrictlyEnforceRange) << 8 << 1 << 5. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 8 << 1 << qreal(5.) << 4; QTest::newRow("insert at beginning") - << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 1 << 4. << 5; + << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 1 << qreal(4.) << 5; QTest::newRow("insert at current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 4 << 1 << 4. << 5; + << int(QDeclarativePathView::StrictlyEnforceRange) << 4 << 1 << qreal(4.) << 5; QTest::newRow("no range - insert after current") - << int(QDeclarativePathView::NoHighlightRange) << 6 << 1 << 5. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 6 << 1 << qreal(5.) << 4; QTest::newRow("no range - insert before current") - << int(QDeclarativePathView::NoHighlightRange) << 2 << 1 << 4. << 5; + << int(QDeclarativePathView::NoHighlightRange) << 2 << 1 << qreal(4.) << 5; QTest::newRow("no range - insert multiple after current") - << int(QDeclarativePathView::NoHighlightRange) << 5 << 2 << 6. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 5 << 2 << qreal(6.) << 4; QTest::newRow("no range - insert multiple before current") - << int(QDeclarativePathView::NoHighlightRange) << 1 << 2 << 4. << 6; + << int(QDeclarativePathView::NoHighlightRange) << 1 << 2 << qreal(4.) << 6; QTest::newRow("no range - insert at end") - << int(QDeclarativePathView::NoHighlightRange) << 8 << 1 << 5. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 8 << 1 << qreal(5.) << 4; QTest::newRow("no range - insert at beginning") - << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << 4. << 5; + << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << qreal(4.) << 5; QTest::newRow("no range - insert at current") - << int(QDeclarativePathView::NoHighlightRange) << 4 << 1 << 4. << 5; + << int(QDeclarativePathView::NoHighlightRange) << 4 << 1 << qreal(4.) << 5; } void tst_QDeclarativePathView::insertModel() @@ -530,38 +530,38 @@ void tst_QDeclarativePathView::removeModel_data() // We have 8 items, with currentIndex == 4 QTest::newRow("remove after current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 6 << 1 << 3. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 6 << 1 << qreal(3.) << 4; QTest::newRow("remove before current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 1 << 4. << 3; + << int(QDeclarativePathView::StrictlyEnforceRange) << 2 << 1 << qreal(4.) << 3; QTest::newRow("remove multiple after current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 2 << 2. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 5 << 2 << qreal(2.) << 4; QTest::newRow("remove multiple before current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 1 << 2 << 4. << 2; + << int(QDeclarativePathView::StrictlyEnforceRange) << 1 << 2 << qreal(4.) << 2; QTest::newRow("remove last") - << int(QDeclarativePathView::StrictlyEnforceRange) << 7 << 1 << 3. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 7 << 1 << qreal(3.) << 4; QTest::newRow("remove first") - << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 1 << 4. << 3; + << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 1 << qreal(4.) << 3; QTest::newRow("remove current") - << int(QDeclarativePathView::StrictlyEnforceRange) << 4 << 1 << 3. << 4; + << int(QDeclarativePathView::StrictlyEnforceRange) << 4 << 1 << qreal(3.) << 4; QTest::newRow("remove all") - << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 8 << 0. << 0; + << int(QDeclarativePathView::StrictlyEnforceRange) << 0 << 8 << qreal(0.) << 0; QTest::newRow("no range - remove after current") - << int(QDeclarativePathView::NoHighlightRange) << 6 << 1 << 3. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 6 << 1 << qreal(3.) << 4; QTest::newRow("no range - remove before current") - << int(QDeclarativePathView::NoHighlightRange) << 2 << 1 << 4. << 3; + << int(QDeclarativePathView::NoHighlightRange) << 2 << 1 << qreal(4.) << 3; QTest::newRow("no range - remove multiple after current") - << int(QDeclarativePathView::NoHighlightRange) << 5 << 2 << 2. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 5 << 2 << qreal(2.) << 4; QTest::newRow("no range - remove multiple before current") - << int(QDeclarativePathView::NoHighlightRange) << 1 << 2 << 4. << 2; + << int(QDeclarativePathView::NoHighlightRange) << 1 << 2 << qreal(4.) << 2; QTest::newRow("no range - remove last") - << int(QDeclarativePathView::NoHighlightRange) << 7 << 1 << 3. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 7 << 1 << qreal(3.) << 4; QTest::newRow("no range - remove first") - << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << 4. << 3; + << int(QDeclarativePathView::NoHighlightRange) << 0 << 1 << qreal(4.) << 3; QTest::newRow("no range - remove current offset") - << int(QDeclarativePathView::NoHighlightRange) << 4 << 1 << 4. << 4; + << int(QDeclarativePathView::NoHighlightRange) << 4 << 1 << qreal(4.) << 4; QTest::newRow("no range - remove all") - << int(QDeclarativePathView::NoHighlightRange) << 0 << 8 << 0. << 0; + << int(QDeclarativePathView::NoHighlightRange) << 0 << 8 << qreal(0.) << 0; } void tst_QDeclarativePathView::removeModel() |