From 9489a672b490fff96aa8db86bac23733422258d7 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 12 Jan 2010 16:29:19 +1000 Subject: Remove duplicate line. --- src/declarative/util/qmlanimation_p.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/util/qmlanimation_p.h b/src/declarative/util/qmlanimation_p.h index a52c36e..cb45266 100644 --- a/src/declarative/util/qmlanimation_p.h +++ b/src/declarative/util/qmlanimation_p.h @@ -74,7 +74,6 @@ class Q_AUTOTEST_EXPORT QmlAbstractAnimation : public QObject, public QmlPropert Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged()) Q_PROPERTY(bool repeat READ repeat WRITE setRepeat NOTIFY repeatChanged) Q_CLASSINFO("DefaultMethod", "start()") - Q_INTERFACES(QmlParserStatus) public: QmlAbstractAnimation(QObject *parent=0); -- cgit v0.12 From 24a7d8559f291c9ff565142bf3a7a230dccb6c63 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 12 Jan 2010 16:32:12 +1000 Subject: Add basic support for property iteration. Task-number: QTBUG-6033 --- src/declarative/qml/qmlobjectscriptclass.cpp | 23 +++++++++++++++++++++++ src/declarative/qml/qmlobjectscriptclass_p.h | 1 + src/declarative/qml/qmlpropertycache.cpp | 11 +++++++++++ src/declarative/qml/qmlpropertycache_p.h | 1 + 4 files changed, 36 insertions(+) diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index 1023579..fbd123a 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -402,5 +402,28 @@ QScriptValue QmlObjectScriptClass::destroy(QScriptContext *context, QScriptEngin return engine->nullValue(); } +QStringList QmlObjectScriptClass::propertyNames(Object *object) +{ + QObject *obj = toQObject(object); + if (!obj) + return QStringList(); + + QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(engine); + + QmlPropertyCache *cache = 0; + QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); + if (ddata) + cache = ddata->propertyCache; + if (!cache) { + cache = enginePrivate->cache(obj); + if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; } + } + + if (!cache) + return QStringList(); + + return cache->propertyNames(); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlobjectscriptclass_p.h b/src/declarative/qml/qmlobjectscriptclass_p.h index 5c488db..457eb2b 100644 --- a/src/declarative/qml/qmlobjectscriptclass_p.h +++ b/src/declarative/qml/qmlobjectscriptclass_p.h @@ -89,6 +89,7 @@ public: Value property(QObject *, const Identifier &); void setProperty(QObject *, const Identifier &name, const QScriptValue &, QmlContext *evalContext = 0); + virtual QStringList propertyNames(Object *); protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 394fa35..3bbf1fe 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -130,6 +130,8 @@ QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject, int methodCount = metaObject->methodCount(); for (int ii = methodCount - 1; ii >= 0; --ii) { QMetaMethod m = metaObject->method(ii); + if (m.access() == QMetaMethod::Private) + continue; QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); @@ -198,6 +200,8 @@ void QmlPropertyCache::append(QmlEngine *engine, const QMetaObject *metaObject, int methodOffset = metaObject->methodOffset(); for (int ii = methodOffset; ii < methodCount; ++ii) { QMetaMethod m = metaObject->method(ii); + if (m.access() == QMetaMethod::Private) + continue; QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); @@ -268,6 +272,8 @@ void QmlPropertyCache::update(QmlEngine *engine, const QMetaObject *metaObject) int methodCount = metaObject->methodCount(); for (int ii = methodCount - 1; ii >= 0; --ii) { QMetaMethod m = metaObject->method(ii); + if (m.access() == QMetaMethod::Private) + continue; QString methodName = QString::fromUtf8(m.signature()); int parenIdx = methodName.indexOf(QLatin1Char('(')); @@ -330,4 +336,9 @@ QString QmlPropertyCache::Data::name(const QMetaObject *metaObject) } } +QStringList QmlPropertyCache::propertyNames() const +{ + return stringCache.keys(); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h index feaa683..a94b2a1 100644 --- a/src/declarative/qml/qmlpropertycache_p.h +++ b/src/declarative/qml/qmlpropertycache_p.h @@ -125,6 +125,7 @@ public: inline Data *property(const QScriptDeclarativeClass::Identifier &id) const; Data *property(const QString &) const; Data *property(int) const; + QStringList propertyNames() const; protected: virtual void clear(); -- cgit v0.12 From 05adc294d063171d9d0accf819826684813d396a Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 13 Jan 2010 12:20:11 +1000 Subject: Remove QByteArray constructor from QmlComponent. It was too easily confused with the QString constructor that had completely different semantics. Use setData() instead. Task-number: QTBUG-6590 --- src/declarative/qml/qmlcomponent.cpp | 16 ---------------- src/declarative/qml/qmlcomponent.h | 4 +--- src/declarative/qml/qmlengine.cpp | 6 ++++-- src/declarative/util/qmlview.cpp | 6 ++++-- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp index a1292f5..9e06016 100644 --- a/src/declarative/qml/qmlcomponent.cpp +++ b/src/declarative/qml/qmlcomponent.cpp @@ -347,22 +347,6 @@ QmlComponent::QmlComponent(QmlEngine *engine, const QString &fileName, } /*! - Create a QmlComponent from the given QML \a data and give it the - specified \a parent and \a engine. \a url is used to provide a base path - for items resolved by this component, and may be an empty url if the - component contains no items to resolve. - - \sa setData() -*/ -QmlComponent::QmlComponent(QmlEngine *engine, const QByteArray &data, const QUrl &url, QObject *parent) - : QObject(*(new QmlComponentPrivate), parent) -{ - Q_D(QmlComponent); - d->engine = engine; - setData(data,url); -} - -/*! \internal */ QmlComponent::QmlComponent(QmlEngine *engine, QmlCompiledData *cc, int start, int count, QObject *parent) diff --git a/src/declarative/qml/qmlcomponent.h b/src/declarative/qml/qmlcomponent.h index 1cc5937..342f503 100644 --- a/src/declarative/qml/qmlcomponent.h +++ b/src/declarative/qml/qmlcomponent.h @@ -75,10 +75,8 @@ class Q_DECLARATIVE_EXPORT QmlComponent : public QObject public: QmlComponent(QObject *parent = 0); QmlComponent(QmlEngine *, QObject *parent=0); - QmlComponent(QmlEngine *, const QString &url, QObject *parent = 0); + QmlComponent(QmlEngine *, const QString &fileName, QObject *parent = 0); QmlComponent(QmlEngine *, const QUrl &url, QObject *parent = 0); - QmlComponent(QmlEngine *, const QByteArray &data, - const QUrl &baseUrl, QObject *parent=0); virtual ~QmlComponent(); Q_ENUMS(Status) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index cdae172..b5e7c2d 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -320,7 +320,8 @@ QmlWorkerScriptEngine *QmlEnginePrivate::getWorkerScriptEngine() \code QmlEngine engine; - QmlComponent component(&engine, "import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); + QmlComponent component(&engine); + component.setData("import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); QmlGraphicsItem *item = qobject_cast(component.create()); //add item to view, etc @@ -703,7 +704,8 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi if(!parentArg) return engine->nullValue(); - QmlComponent component(activeEngine, qml.toUtf8(), url); + QmlComponent component(activeEngine); + component.setData(qml.toUtf8(), url); if(component.isError()) { QList errors = component.errors(); diff --git a/src/declarative/util/qmlview.cpp b/src/declarative/util/qmlview.cpp index b5f33f2..690924f 100644 --- a/src/declarative/util/qmlview.cpp +++ b/src/declarative/util/qmlview.cpp @@ -290,7 +290,8 @@ void QmlView::execute() if (d->qml.isEmpty()) { d->component = new QmlComponent(&d->engine, d->source, this); } else { - d->component = new QmlComponent(&d->engine, d->qml.toUtf8(), d->source, this); + d->component = new QmlComponent(&d->engine, this); + d->component->setData(d->qml.toUtf8(), d->source); } connect (&d->engine, SIGNAL (quit ()), this, SIGNAL (quit ())); @@ -485,7 +486,8 @@ QmlGraphicsItem* QmlView::addItem(const QString &qml, QmlGraphicsItem* parent) if (!d->root) return 0; - QmlComponent component(&d->engine, qml.toUtf8(), QUrl()); + QmlComponent component(&d->engine); + component.setData(qml.toUtf8(), QUrl()); if(d->component->isError()) { QList errorList = d->component->errors(); foreach (const QmlError &error, errorList) { -- cgit v0.12 From 8f1fb137cb47951dc67409372a6763ddb17d65ca Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 13 Jan 2010 12:48:18 +1000 Subject: Fix tests after 05adc294d063171d9d0accf819826684813d396a --- .../animatedimage/tst_animatedimage.cpp | 3 +- .../datetimeformatter/tst_datetimeformatter.cpp | 11 +- .../numberformatter/tst_numberformatter.cpp | 3 +- .../declarative/parserstress/tst_parserstress.cpp | 4 +- .../qmlfontloader/tst_qmlfontloader.cpp | 18 ++- .../tst_qmlgraphicsborderimage.cpp | 32 +++-- .../qmlgraphicsimage/tst_qmlgraphicsimage.cpp | 18 ++- .../qmlgraphicsloader/tst_qmlgraphicsloader.cpp | 21 ++- .../qmlgraphicstext/tst_qmlgraphicstext.cpp | 160 ++++++++++++++------- .../tst_qmlgraphicstextedit.cpp | 90 ++++++++---- .../tst_qmlgraphicstextinput.cpp | 45 ++++-- .../declarative/qmllanguage/tst_qmllanguage.cpp | 6 +- .../declarative/qmllistmodel/tst_qmllistmodel.cpp | 8 +- .../qmlmetaproperty/tst_qmlmetaproperty.cpp | 9 +- .../qmlpropertymap/tst_qmlpropertymap.cpp | 3 +- .../qmlsystempalette/tst_qmlsystempalette.cpp | 12 +- tests/auto/declarative/shared/debugutil.cpp | 3 +- tests/auto/declarative/sql/tst_sql.cpp | 3 +- 18 files changed, 298 insertions(+), 151 deletions(-) diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp index 5ba0068..20b344d 100644 --- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp +++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp @@ -173,7 +173,8 @@ void tst_animatedimage::remote_data() void tst_animatedimage::invalidSource() { QmlEngine engine; - QmlComponent component(&engine, "import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl("file://")); + QmlComponent component(&engine); + component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl("file://")); QVERIFY(component.isReady()); QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); diff --git a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp index e9b4879..b5437b9 100644 --- a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp +++ b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp @@ -59,8 +59,9 @@ private slots: void tst_datetimeformatter::date() { QmlEngine engine; - QmlComponent formatterComponent(&engine, QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"), - QUrl("file://")); + QmlComponent formatterComponent(&engine); + formatterComponent.setData(QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"), + QUrl("file://")); QmlDateTimeFormatter *formatter = qobject_cast(formatterComponent.create()); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); @@ -88,7 +89,8 @@ void tst_datetimeformatter::date() void tst_datetimeformatter::time() { QmlEngine engine; - QmlComponent formatterComponent(&engine, "import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl("file://")); + QmlComponent formatterComponent(&engine); + formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl("file://")); QmlDateTimeFormatter *formatter = qobject_cast(formatterComponent.create()); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); @@ -120,7 +122,8 @@ void tst_datetimeformatter::time() void tst_datetimeformatter::dateTime() { QmlEngine engine; - QmlComponent formatterComponent(&engine, "import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl("file://")); + QmlComponent formatterComponent(&engine); + formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl("file://")); QmlDateTimeFormatter *formatter = qobject_cast(formatterComponent.create()); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); diff --git a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp index 1d68f35..e297961 100644 --- a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp +++ b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp @@ -203,7 +203,8 @@ void tst_numberformat::text() QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: ") + string + QString("; format: \"") + format + QString("\" }"); QmlEngine engine; - QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file:///")); + QmlComponent formatterComponent(&engine); + formatterComponent.setData(componentStr.toUtf8(), QUrl("file:///")); if(formatterComponent.isError()) qDebug() << formatterComponent.errors(); QVERIFY(formatterComponent.isReady()); diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index e584140..fe177d1 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -130,8 +130,8 @@ void tst_parserstress::ecmascript() QByteArray qmlData = qml.toUtf8(); - QmlComponent component(&engine, qmlData, - QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); + QmlComponent component(&engine); + component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); QVERIFY(!component.isError()); } diff --git a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp index 954046e..27664fb 100644 --- a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp +++ b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp @@ -72,7 +72,8 @@ tst_qmlfontloader::tst_qmlfontloader() void tst_qmlfontloader::noFont() { QString componentStr = "import Qt 4.6\nFontLoader { }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast(component.create()); QVERIFY(fontObject != 0); @@ -86,7 +87,8 @@ void tst_qmlfontloader::noFont() void tst_qmlfontloader::namedFont() { QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast(component.create()); QVERIFY(fontObject != 0); @@ -98,7 +100,8 @@ void tst_qmlfontloader::namedFont() void tst_qmlfontloader::localFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/FreeMono.ttf\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast(component.create()); QVERIFY(fontObject != 0); @@ -111,7 +114,8 @@ void tst_qmlfontloader::failLocalFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/dummy.ttf\" }"; QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"file://" SRCDIR "/data/dummy.ttf\" ) "); - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast(component.create()); QVERIFY(fontObject != 0); @@ -123,7 +127,8 @@ void tst_qmlfontloader::failLocalFont() void tst_qmlfontloader::webFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast(component.create()); QVERIFY(fontObject != 0); @@ -136,7 +141,8 @@ void tst_qmlfontloader::failWebFont() { QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://wrong.address.com/Starburst.ttf\" }"; QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://wrong.address.com/Starburst.ttf\" ) "); - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlFontLoader *fontObject = qobject_cast(component.create()); QVERIFY(fontObject != 0); diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp index bcdfa2e..ceee8f6 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp +++ b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp @@ -100,7 +100,8 @@ tst_qmlgraphicsborderimage::tst_qmlgraphicsborderimage() void tst_qmlgraphicsborderimage::noSource() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->source(), QUrl()); @@ -123,7 +124,7 @@ void tst_qmlgraphicsborderimage::imageSource_data() << "Cannot open QUrl( \"file://" SRCDIR "/data/no-such-file.png\" ) "; QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true - << "Network error loading QUrl( \"" SERVER_ADDR "/no-such-file.png\" ) " + << "Network error loading \"" SERVER_ADDR "/no-such-file.png\" " "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; } @@ -144,7 +145,8 @@ void tst_qmlgraphicsborderimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); @@ -172,7 +174,8 @@ void tst_qmlgraphicsborderimage::clearSource() QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }"; QmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", SRCDIR "/data/colors.png"); - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QVERIFY(obj->status() == QmlGraphicsBorderImage::Ready); @@ -189,7 +192,8 @@ void tst_qmlgraphicsborderimage::clearSource() void tst_qmlgraphicsborderimage::resized() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -203,7 +207,8 @@ void tst_qmlgraphicsborderimage::resized() void tst_qmlgraphicsborderimage::smooth() { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -219,7 +224,8 @@ void tst_qmlgraphicsborderimage::tileModes() { { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 100.); @@ -231,7 +237,8 @@ void tst_qmlgraphicsborderimage::tileModes() } { QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -257,7 +264,8 @@ void tst_qmlgraphicsborderimage::sciSource() } QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); @@ -301,7 +309,8 @@ void tst_qmlgraphicsborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/invalid.sci\"; width: 300; height: 300 }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -318,7 +327,8 @@ void tst_qmlgraphicsborderimage::pendingRemoteRequest() QFETCH(QString, source); QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsBorderImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->status(), QmlGraphicsBorderImage::Loading); diff --git a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp index 26f5175..9731ef1 100644 --- a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp @@ -94,7 +94,8 @@ tst_qmlgraphicsimage::tst_qmlgraphicsimage() void tst_qmlgraphicsimage::noSource() { QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->source(), QUrl()); @@ -138,7 +139,8 @@ void tst_qmlgraphicsimage::imageSource() QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); @@ -165,7 +167,8 @@ void tst_qmlgraphicsimage::clearSource() QString componentStr = "import Qt 4.6\nImage { source: srcImage }"; QmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", SRCDIR "/data/colors.png"); - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QVERIFY(obj->status() == QmlGraphicsImage::Ready); @@ -184,7 +187,8 @@ void tst_qmlgraphicsimage::clearSource() void tst_qmlgraphicsimage::resized() { QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -197,7 +201,8 @@ void tst_qmlgraphicsimage::resized() void tst_qmlgraphicsimage::smooth() { QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QCOMPARE(obj->width(), 300.); @@ -216,7 +221,8 @@ void tst_qmlgraphicsimage::pixmap() QmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("testPixmap", pixmap); - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsImage *obj = qobject_cast(component.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp index b1e76e1..9d61f50 100644 --- a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp +++ b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp @@ -92,7 +92,8 @@ tst_QmlGraphicsLoader::tst_QmlGraphicsLoader() void tst_QmlGraphicsLoader::url() { - QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); + QmlComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); @@ -124,7 +125,8 @@ void tst_QmlGraphicsLoader::invalidUrl() { QTest::ignoreMessage(QtWarningMsg, "(:-1: File error for URL file://" SRCDIR "/data/IDontExist.qml) "); - QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + QmlComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item() == 0); @@ -138,7 +140,8 @@ void tst_QmlGraphicsLoader::invalidUrl() void tst_QmlGraphicsLoader::clear() { { - QmlComponent component(&engine, QByteArray( + QmlComponent component(&engine); + component.setData(QByteArray( "import Qt 4.6\n" " Loader { id: loader\n" " source: 'Rect120x60.qml'\n" @@ -184,7 +187,8 @@ void tst_QmlGraphicsLoader::clear() void tst_QmlGraphicsLoader::urlToComponent() { - QmlComponent component(&engine, QByteArray("import Qt 4.6\n" + QmlComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\n" "Loader {\n" " id: loader\n" " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" @@ -292,7 +296,8 @@ void tst_QmlGraphicsLoader::networkRequestUrl() QVERIFY(server.isValid()); server.serveDirectory("data"); - QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), TEST_FILE("")); + QmlComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), TEST_FILE("")); QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); @@ -312,7 +317,8 @@ void tst_QmlGraphicsLoader::networkComponent() QVERIFY(server.isValid()); server.serveDirectory("slowdata", TestHTTPServer::Delay); - QmlComponent component(&engine, QByteArray( + QmlComponent component(&engine); + component.setData(QByteArray( "import Qt 4.6\n" "import \"http://127.0.0.1:14445/\" as NW\n" "Item {\n" @@ -344,7 +350,8 @@ void tst_QmlGraphicsLoader::failNetworkRequest() QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14445/IDontExist.qml) "); - QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), TEST_FILE("")); + QmlComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), TEST_FILE("")); QmlGraphicsLoader *loader = qobject_cast(component.create()); QVERIFY(loader != 0); diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp index 1e10873..72ec5ec 100644 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp @@ -155,7 +155,8 @@ tst_qmlgraphicstext::tst_qmlgraphicstext() void tst_qmlgraphicstext::text() { { - QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -168,7 +169,9 @@ void tst_qmlgraphicstext::text() for (int i = 0; i < standard.size(); i++) { QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); + QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -179,7 +182,8 @@ void tst_qmlgraphicstext::text() for (int i = 0; i < richText.size(); i++) { QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -193,7 +197,8 @@ void tst_qmlgraphicstext::width() { // uses Font metrics to find the width for standard and document to find the width for rich { - QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -210,7 +215,8 @@ void tst_qmlgraphicstext::width() metricWidth = floor(metricWidth); QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -229,7 +235,8 @@ void tst_qmlgraphicstext::width() int documentWidth = document.idealWidth(); QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -243,7 +250,8 @@ void tst_qmlgraphicstext::wrap() int textHeight = 0; // for specified width and wrap set true { - QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); textHeight = textObject->height(); @@ -255,7 +263,8 @@ void tst_qmlgraphicstext::wrap() for (int i = 0; i < standard.size(); i++) { QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -270,7 +279,8 @@ void tst_qmlgraphicstext::wrap() for (int i = 0; i < richText.size(); i++) { QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -289,7 +299,8 @@ void tst_qmlgraphicstext::elide() // XXX Poor coverage. { - QmlComponent textComponent(&engine, ("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -299,7 +310,8 @@ void tst_qmlgraphicstext::elide() for (int i = 0; i < standard.size(); i++) { QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -310,7 +322,8 @@ void tst_qmlgraphicstext::elide() for (int i = 0; i < richText.size(); i++) { QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -322,14 +335,16 @@ void tst_qmlgraphicstext::elide() void tst_qmlgraphicstext::textFormat() { { - QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); QVERIFY(textObject->textFormat() == QmlGraphicsText::RichText); } { - QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.PlainText }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.PlainText }", QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -347,7 +362,8 @@ void tst_qmlgraphicstext::horizontalAlignment() for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); @@ -359,7 +375,8 @@ void tst_qmlgraphicstext::horizontalAlignment() for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); @@ -377,7 +394,8 @@ void tst_qmlgraphicstext::verticalAlignment() for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -390,7 +408,8 @@ void tst_qmlgraphicstext::verticalAlignment() for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -405,7 +424,8 @@ void tst_qmlgraphicstext::font() //test size, then bold, then italic, then family { QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().pointSize(), 40); @@ -415,7 +435,8 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().pixelSize(), 40); @@ -425,7 +446,8 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().bold(), true); @@ -434,7 +456,8 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().italic(), true); @@ -443,7 +466,8 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().family(), QString("Helvetica")); @@ -453,7 +477,8 @@ void tst_qmlgraphicstext::font() { QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->font().family(), QString("")); @@ -466,7 +491,8 @@ void tst_qmlgraphicstext::style() for (int i = 0; i < styles.size(); i++) { QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE((int)textObject->style(), (int)styles.at(i)); @@ -480,7 +506,8 @@ void tst_qmlgraphicstext::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); @@ -490,7 +517,8 @@ void tst_qmlgraphicstext::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i))); @@ -503,7 +531,8 @@ void tst_qmlgraphicstext::color() for (int j = 0; j < colorStrings.size(); j++) { QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); @@ -516,7 +545,8 @@ void tst_qmlgraphicstext::color() testColor.setAlpha(170); QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->color(), testColor); @@ -529,13 +559,15 @@ void tst_qmlgraphicstext::smooth() { { QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), false); } @@ -544,13 +576,15 @@ void tst_qmlgraphicstext::smooth() { { QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QCOMPARE(textObject->smooth(), false); } @@ -561,7 +595,8 @@ void tst_qmlgraphicstext::weight() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -569,7 +604,8 @@ void tst_qmlgraphicstext::weight() } { QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -581,7 +617,8 @@ void tst_qmlgraphicstext::underline() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -589,7 +626,8 @@ void tst_qmlgraphicstext::underline() } { QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -601,7 +639,8 @@ void tst_qmlgraphicstext::overline() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -609,7 +648,8 @@ void tst_qmlgraphicstext::overline() } { QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -621,7 +661,8 @@ void tst_qmlgraphicstext::strikeout() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -629,7 +670,8 @@ void tst_qmlgraphicstext::strikeout() } { QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -641,7 +683,8 @@ void tst_qmlgraphicstext::capitalization() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -649,7 +692,8 @@ void tst_qmlgraphicstext::capitalization() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -657,7 +701,8 @@ void tst_qmlgraphicstext::capitalization() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -665,7 +710,8 @@ void tst_qmlgraphicstext::capitalization() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -673,7 +719,8 @@ void tst_qmlgraphicstext::capitalization() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -685,7 +732,8 @@ void tst_qmlgraphicstext::letterSpacing() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -693,7 +741,8 @@ void tst_qmlgraphicstext::letterSpacing() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -701,7 +750,8 @@ void tst_qmlgraphicstext::letterSpacing() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -713,7 +763,8 @@ void tst_qmlgraphicstext::wordSpacing() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -721,7 +772,8 @@ void tst_qmlgraphicstext::wordSpacing() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -729,7 +781,8 @@ void tst_qmlgraphicstext::wordSpacing() } { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -759,7 +812,8 @@ void tst_qmlgraphicstext::clickLink() { { QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl("file://")); QmlGraphicsText *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp index 66ecff6..23ecf2b 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp @@ -144,7 +144,8 @@ tst_qmlgraphicstextedit::tst_qmlgraphicstextedit() void tst_qmlgraphicstextedit::text() { { - QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -154,7 +155,8 @@ void tst_qmlgraphicstextedit::text() for (int i = 0; i < standard.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -164,7 +166,8 @@ void tst_qmlgraphicstextedit::text() for (int i = 0; i < richText.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -182,7 +185,8 @@ void tst_qmlgraphicstextedit::width() { // uses Font metrics to find the width for standard and document to find the width for rich { - QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -197,7 +201,8 @@ void tst_qmlgraphicstextedit::width() metricWidth = floor(metricWidth); QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -213,7 +218,8 @@ void tst_qmlgraphicstextedit::width() int documentWidth = document.idealWidth(); QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -225,7 +231,8 @@ void tst_qmlgraphicstextedit::wrap() { // for specified width and wrap set true { - QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -235,7 +242,8 @@ void tst_qmlgraphicstextedit::wrap() for (int i = 0; i < standard.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -245,7 +253,8 @@ void tst_qmlgraphicstextedit::wrap() for (int i = 0; i < richText.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -257,14 +266,16 @@ void tst_qmlgraphicstextedit::wrap() void tst_qmlgraphicstextedit::textFormat() { { - QmlComponent textComponent(&engine, "import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl("file://")); QmlGraphicsTextEdit *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); QVERIFY(textObject->textFormat() == QmlGraphicsTextEdit::RichText); } { - QmlComponent textComponent(&engine, "import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.PlainText }", QUrl("file://")); + QmlComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.PlainText }", QUrl("file://")); QmlGraphicsTextEdit *textObject = qobject_cast(textComponent.create()); QVERIFY(textObject != 0); @@ -282,7 +293,8 @@ void tst_qmlgraphicstextedit::hAlign() for (int j=0; j < hAlignmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -295,7 +307,8 @@ void tst_qmlgraphicstextedit::hAlign() for (int j=0; j < hAlignmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -314,7 +327,8 @@ void tst_qmlgraphicstextedit::vAlign() for (int j=0; j < vAlignmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -327,7 +341,8 @@ void tst_qmlgraphicstextedit::vAlign() for (int j=0; j < vAlignmentStrings.size(); j++) { QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -342,7 +357,8 @@ void tst_qmlgraphicstextedit::font() //test size, then bold, then italic, then family { QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -353,7 +369,8 @@ void tst_qmlgraphicstextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -363,7 +380,8 @@ void tst_qmlgraphicstextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -373,7 +391,8 @@ void tst_qmlgraphicstextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -384,7 +403,8 @@ void tst_qmlgraphicstextedit::font() { QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -398,7 +418,8 @@ void tst_qmlgraphicstextedit::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i)); QVERIFY(textEditObject != 0); @@ -409,7 +430,8 @@ void tst_qmlgraphicstextedit::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->selectionColor(), QColor(colorStrings.at(i))); @@ -419,7 +441,8 @@ void tst_qmlgraphicstextedit::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->selectedTextColor(), QColor(colorStrings.at(i))); @@ -431,7 +454,8 @@ void tst_qmlgraphicstextedit::color() testColor.setAlpha(170); QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -443,7 +467,8 @@ void tst_qmlgraphicstextedit::textMargin() { for(qreal i=0; i<=10; i+=0.3){ QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->textMargin(), i); @@ -454,7 +479,8 @@ void tst_qmlgraphicstextedit::persistentSelection() { { QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->persistentSelection(), true); @@ -462,7 +488,8 @@ void tst_qmlgraphicstextedit::persistentSelection() { QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->persistentSelection(), false); @@ -473,7 +500,8 @@ void tst_qmlgraphicstextedit::focusOnPress() { { QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->focusOnPress(), true); @@ -481,7 +509,8 @@ void tst_qmlgraphicstextedit::focusOnPress() { QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); QCOMPARE(textEditObject->focusOnPress(), false); @@ -492,7 +521,8 @@ void tst_qmlgraphicstextedit::selection() { QString testStr = standard[0];//TODO: What should happen for multiline/rich text? QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; - QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextEdit *textEditObject = qobject_cast(texteditComponent.create()); QVERIFY(textEditObject != 0); diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp index 0eba11b..02772ec 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp +++ b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp @@ -100,7 +100,8 @@ tst_qmlgraphicstextinput::tst_qmlgraphicstextinput() void tst_qmlgraphicstextinput::text() { { - QmlComponent textinputComponent(&engine, "import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -110,7 +111,8 @@ void tst_qmlgraphicstextinput::text() for (int i = 0; i < standard.size(); i++) { QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -123,7 +125,8 @@ void tst_qmlgraphicstextinput::width() { // uses Font metrics to find the width for standard { - QmlComponent textinputComponent(&engine, "import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -137,7 +140,8 @@ void tst_qmlgraphicstextinput::width() qreal metricWidth = fm.width(standard.at(i)); QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -150,7 +154,8 @@ void tst_qmlgraphicstextinput::font() //test size, then bold, then italic, then family { QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -161,7 +166,8 @@ void tst_qmlgraphicstextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -171,7 +177,8 @@ void tst_qmlgraphicstextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -181,7 +188,8 @@ void tst_qmlgraphicstextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -192,7 +200,8 @@ void tst_qmlgraphicstextinput::font() { QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -206,7 +215,8 @@ void tst_qmlgraphicstextinput::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); @@ -216,7 +226,8 @@ void tst_qmlgraphicstextinput::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i))); @@ -226,7 +237,8 @@ void tst_qmlgraphicstextinput::color() for (int i = 0; i < colorStrings.size(); i++) { QString componentStr = "import Qt 4.6\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i))); @@ -238,7 +250,8 @@ void tst_qmlgraphicstextinput::color() testColor.setAlpha(170); QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -250,7 +263,8 @@ void tst_qmlgraphicstextinput::selection() { QString testStr = standard[0]; QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -380,7 +394,8 @@ void tst_qmlgraphicstextinput::masks() void tst_qmlgraphicstextinput::validators() { QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; - QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); + QmlComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); QmlGraphicsTextInput *textinputObject = qobject_cast(textinputComponent.create()); QVERIFY(textinputObject != 0); diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp index 3b7c298..506c71a 100644 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp @@ -1000,7 +1000,8 @@ void tst_qmllanguage::scriptString() // Check that first child of qml is of given type. Empty type insists on error. void tst_qmllanguage::testType(const QString& qml, const QString& type) { - QmlComponent component(&engine, qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports + QmlComponent component(&engine); + component.setData(qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports QTRY_VERIFY(!component.isLoading()); @@ -1313,7 +1314,8 @@ void tst_qmllanguage::qmlAttachedPropertiesObjectMethod() void tst_qmllanguage::crash1() { - QmlComponent component(&engine, "Component {}"); + QmlComponent component(&engine); + component.setData("import Qt 4.6\nComponent {}", QUrl()); } void tst_qmllanguage::crash2() diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp index 0d09b54..0986d20 100644 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp @@ -63,7 +63,8 @@ void tst_QmlListModel::static_i18n() QString expect = QString::fromUtf8("na\303\257ve"); QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; QmlEngine engine; - QmlComponent component(&engine, componentStr.toUtf8(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toUtf8(), QUrl("file://")); QmlListModel *obj = qobject_cast(component.create()); QVERIFY(obj != 0); QString prop = obj->get(0).property(QLatin1String("prop1")).toString(); @@ -208,8 +209,9 @@ void tst_QmlListModel::error() QFETCH(QString, error); QmlEngine engine; - QmlComponent component(&engine, qml.toUtf8(), - QUrl::fromLocalFile(QString("dummy.qml"))); + QmlComponent component(&engine); + component.setData(qml.toUtf8(), + QUrl::fromLocalFile(QString("dummy.qml"))); if (error.isEmpty()) { QVERIFY(!component.isError()); } else { diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp index 8dcfc11..63d8274 100644 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp @@ -900,7 +900,8 @@ void tst_qmlmetaproperty::write() void tst_qmlmetaproperty::writeObjectToList() { - QmlComponent containerComponent(&engine, "import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); + QmlComponent containerComponent(&engine); + containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); MyContainer *container = qobject_cast(containerComponent.create()); QVERIFY(container != 0); QVERIFY(container->children()->size() == 1); @@ -915,7 +916,8 @@ void tst_qmlmetaproperty::writeObjectToList() Q_DECLARE_METATYPE(QList); void tst_qmlmetaproperty::writeListToList() { - QmlComponent containerComponent(&engine, "import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); + QmlComponent containerComponent(&engine); + containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); MyContainer *container = qobject_cast(containerComponent.create()); QVERIFY(container != 0); QVERIFY(container->children()->size() == 1); @@ -935,7 +937,8 @@ void tst_qmlmetaproperty::writeListToList() void tst_qmlmetaproperty::writeObjectToQmlList() { - QmlComponent containerComponent(&engine, "import Test 1.0\nMyContainer { qmlChildren: MyQmlObject {} }", QUrl()); + QmlComponent containerComponent(&engine); + containerComponent.setData("import Test 1.0\nMyContainer { qmlChildren: MyQmlObject {} }", QUrl()); MyContainer *container = qobject_cast(containerComponent.create()); QVERIFY(container != 0); QVERIFY(container->qmlChildren()->size() == 1); diff --git a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp index fe2658c..ba3bdd2 100644 --- a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp +++ b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp @@ -135,7 +135,8 @@ void tst_QmlPropertyMap::changed() QmlEngine engine; QmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty(QLatin1String("testdata"), &map); - QmlComponent component(&engine, "import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", + QmlComponent component(&engine); + component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", QUrl("file://")); QVERIFY(component.isReady()); QmlGraphicsText *txt = qobject_cast(component.create()); diff --git a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp index 008dfb3..12e3a70 100644 --- a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp +++ b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp @@ -71,7 +71,8 @@ tst_qmlsystempalette::tst_qmlsystempalette() void tst_qmlsystempalette::activePalette() { QString componentStr = "import Qt 4.6\nSystemPalette { }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlSystemPalette *object = qobject_cast(component.create()); QVERIFY(object != 0); @@ -99,7 +100,8 @@ void tst_qmlsystempalette::activePalette() void tst_qmlsystempalette::inactivePalette() { QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlSystemPalette *object = qobject_cast(component.create()); QVERIFY(object != 0); @@ -128,7 +130,8 @@ void tst_qmlsystempalette::inactivePalette() void tst_qmlsystempalette::disabledPalette() { QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlSystemPalette *object = qobject_cast(component.create()); QVERIFY(object != 0); @@ -157,7 +160,8 @@ void tst_qmlsystempalette::disabledPalette() void tst_qmlsystempalette::paletteChanged() { QString componentStr = "import Qt 4.6\nSystemPalette { }"; - QmlComponent component(&engine, componentStr.toLatin1(), QUrl("file://")); + QmlComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl("file://")); QmlSystemPalette *object = qobject_cast(component.create()); QVERIFY(object != 0); diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 8f6fdef..b8245b5 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -157,7 +157,8 @@ int QmlDebugTest::runTests(QmlTestFactory *factory, const QList &qml QmlEngine engine; // blocks until client connects foreach (const QByteArray &code, qml) { - QmlComponent c(&engine, code, QUrl("file://")); + QmlComponent c(&engine); + c.setData(code, QUrl("file://")); Q_ASSERT(c.isReady()); // fails if bad syntax data.items << qobject_cast(c.create()); } diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 1e4e6f8..9bc667d 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -200,7 +200,8 @@ void tst_sql::testQml() "Text { Script { source: \""+jsfile+"\" } text: test() }"; engine->setOfflineStoragePath(dbDir()); - QmlComponent component(engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports + QmlComponent component(engine); + component.setData(qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports QmlGraphicsText *text = qobject_cast(component.create()); QVERIFY(text != 0); QCOMPARE(text->text(),QString("passed")); -- cgit v0.12