summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-01-13 02:20:11 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-01-13 02:23:50 (GMT)
commit05adc294d063171d9d0accf819826684813d396a (patch)
tree3faded5e3483b6bc22857a148db1c2ae5ab42a90
parent24a7d8559f291c9ff565142bf3a7a230dccb6c63 (diff)
downloadQt-05adc294d063171d9d0accf819826684813d396a.zip
Qt-05adc294d063171d9d0accf819826684813d396a.tar.gz
Qt-05adc294d063171d9d0accf819826684813d396a.tar.bz2
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
-rw-r--r--src/declarative/qml/qmlcomponent.cpp16
-rw-r--r--src/declarative/qml/qmlcomponent.h4
-rw-r--r--src/declarative/qml/qmlengine.cpp6
-rw-r--r--src/declarative/util/qmlview.cpp6
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<QmlGraphicsItem *>(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<QmlError> 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<QmlError> errorList = d->component->errors();
foreach (const QmlError &error, errorList) {