summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-27 16:42:14 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-27 16:42:14 (GMT)
commita17339e943f21bb6c6e16884f716dd9ab8f94938 (patch)
treef75b19e3a5f9d436c00c6b269488414513d943c5 /src/declarative/qml
parentc78fb096c31df3b7d3cd9018f26518f59f4fde65 (diff)
parentba97ea29d33acf9ab421f4d8ef5202ec83231d7e (diff)
downloadQt-a17339e943f21bb6c6e16884f716dd9ab8f94938.zip
Qt-a17339e943f21bb6c6e16884f716dd9ab8f94938.tar.gz
Qt-a17339e943f21bb6c6e16884f716dd9ab8f94938.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (30 commits) Ensure text document is created before we access it. Plugins documentation. Fix update issue when an item has an effect and child. Fix QDeclarativeTextInput and QGraphicsView in regards of input methods hints. Disallow "Qt" as namespace import Don't "adjust" the z value of a delegate that has been cached. Correctly inherit extension properties Autotests More QDeclarativeNetworkAccessManagerFactory doc clarification. Fix QDeclarativeNetworkAccessManagerFactory docs. Don't crash on invalid model remove signal. Ensure scheduled layout can occur before testing. Fix remaining 4.6 type registrations (to 4.7). doc anchor margins vs. anchor (line) state/animation. These examples should not be included in this test Unify naming of settings / UI to be "Qt Qml Runtime" Improved error messages for type resolving, new debug option Link to example files from tutorial pages Add tutorial for writing QML extensions no export in plugin ...
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp81
-rw-r--r--src/declarative/qml/qdeclarativecompositetypemanager.cpp6
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp196
-rw-r--r--src/declarative/qml/qdeclarativeengine_p.h3
-rw-r--r--src/declarative/qml/qdeclarativeextensionplugin.cpp15
-rw-r--r--src/declarative/qml/qdeclarativemetatype.cpp2
-rw-r--r--src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp9
-rw-r--r--src/declarative/qml/qdeclarativescriptparser.cpp8
8 files changed, 243 insertions, 77 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index c697367..d8bbb70 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -154,7 +154,7 @@ int statusId = qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeCom
\value Null This QDeclarativeComponent has no data. Call loadUrl() or setData() to add QML content.
\value Ready This QDeclarativeComponent is ready and create() may be called.
\value Loading This QDeclarativeComponent is loading network data.
- \value Error An error has occured. Calling errorDescription() to retrieve a description.
+ \value Error An error has occured. Call errors() to retrieve a list of \{QDeclarativeError}{errors}.
*/
void QDeclarativeComponentPrivate::typeDataReady()
@@ -239,6 +239,18 @@ QDeclarativeComponent::~QDeclarativeComponent()
}
/*!
+ \qmlproperty enumeration Component::status
+ This property holds the status of component loading. It can be one of:
+ \list
+ \o Null - no data is available for the component
+ \o Ready - the component has been loaded, and can be used to create instances.
+ \o Loading - the component is currently being loaded
+ \o Error - an error occurred while loading the component.
+ Calling errorsString() will provide a human-readable description of any errors.
+ \endlist
+ */
+
+/*!
\property QDeclarativeComponent::status
The component's current \l{QDeclarativeComponent::Status} {status}.
*/
@@ -257,6 +269,14 @@ QDeclarativeComponent::Status QDeclarativeComponent::status() const
}
/*!
+ \qmlproperty bool Component::isNull
+
+ Is true if the component is in the Null state, false otherwise.
+
+ Equivalent to status == Component.Null.
+*/
+
+/*!
\property QDeclarativeComponent::isNull
Is true if the component is in the Null state, false otherwise.
@@ -269,6 +289,14 @@ bool QDeclarativeComponent::isNull() const
}
/*!
+ \qmlproperty bool Component::isReady
+
+ Is true if the component is in the Ready state, false otherwise.
+
+ Equivalent to status == Component.Ready.
+*/
+
+/*!
\property QDeclarativeComponent::isReady
Is true if the component is in the Ready state, false otherwise.
@@ -281,6 +309,16 @@ bool QDeclarativeComponent::isReady() const
}
/*!
+ \qmlproperty bool Component::isError
+
+ Is true if the component is in the Error state, false otherwise.
+
+ Equivalent to status == Component.Error.
+
+ Calling errorsString() will provide a human-readable description of any errors.
+*/
+
+/*!
\property QDeclarativeComponent::isError
Is true if the component is in the Error state, false otherwise.
@@ -293,6 +331,14 @@ bool QDeclarativeComponent::isError() const
}
/*!
+ \qmlproperty bool Component::isLoading
+
+ Is true if the component is in the Loading state, false otherwise.
+
+ Equivalent to status == Component::Loading.
+*/
+
+/*!
\property QDeclarativeComponent::isLoading
Is true if the component is in the Loading state, false otherwise.
@@ -305,6 +351,12 @@ bool QDeclarativeComponent::isLoading() const
}
/*!
+ \qmlproperty real Component::progress
+ The progress of loading the component, from 0.0 (nothing loaded)
+ to 1.0 (finished).
+*/
+
+/*!
\property QDeclarativeComponent::progress
The progress of loading the component, from 0.0 (nothing loaded)
to 1.0 (finished).
@@ -490,6 +542,17 @@ QList<QDeclarativeError> QDeclarativeComponent::errors() const
}
/*!
+ \qmlmethod string Component::errorsString()
+
+ Returns a human-readable description of any errors.
+
+ The string includes the file, location, and description of each error.
+ If multiple errors are present they are separated by a newline character.
+
+ If no errors are present, an empty string is returned.
+*/
+
+/*!
\internal
errorsString is only meant as a way to get the errors in script
*/
@@ -508,6 +571,11 @@ QString QDeclarativeComponent::errorsString() const
}
/*!
+ \qmlproperty url Component::url
+ The component URL. This is the URL that was used to construct the component.
+*/
+
+/*!
\property QDeclarativeComponent::url
The component URL. This is the URL passed to either the constructor,
or the loadUrl() or setData() methods.
@@ -527,6 +595,13 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeComponentPrivate &dd, Q
}
/*!
+ \qmlmethod object Component::createObject()
+ Returns an object instance from this component, or null if object creation fails.
+
+ The object will be created in the same context as the component was created in.
+*/
+
+/*!
\internal
A version of create which returns a scriptObject, for use in script
*/
@@ -535,10 +610,10 @@ QScriptValue QDeclarativeComponent::createObject()
Q_D(QDeclarativeComponent);
QDeclarativeContext* ctxt = creationContext();
if(!ctxt)
- return QScriptValue();
+ return QScriptValue(QScriptValue::NullValue);
QObject* ret = create(ctxt);
if (!ret)
- return QScriptValue();
+ return QScriptValue(QScriptValue::NullValue);
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(d->engine);
QDeclarativeData::get(ret, true)->setImplicitDestructible();
return priv->objectClass->newQObject(ret, QMetaType::QObjectStar);
diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
index adeb7a5..0eb7e1b 100644
--- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp
+++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp
@@ -617,7 +617,8 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
int majorVersion;
int minorVersion;
QDeclarativeEnginePrivate::ImportedNamespace *typeNamespace = 0;
- if (!QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, &typeNamespace)
+ QString errorString;
+ if (!QDeclarativeEnginePrivate::get(engine)->resolveType(unit->imports, typeName, &ref.type, &url, &majorVersion, &minorVersion, &typeNamespace, &errorString)
|| typeNamespace)
{
// Known to not be a type:
@@ -630,7 +631,8 @@ int QDeclarativeCompositeTypeManager::resolveTypes(QDeclarativeCompositeTypeData
if (typeNamespace)
error.setDescription(tr("Namespace %1 cannot be used as a type").arg(userTypeName));
else
- error.setDescription(tr("%1 is not a type").arg(userTypeName));
+ error.setDescription(tr("%1 %2").arg(userTypeName).arg(errorString));
+
if (!parserRef->refObjects.isEmpty()) {
QDeclarativeParser::Object *obj = parserRef->refObjects.first();
error.setLine(obj->location.start.line);
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 8eae120..0ee6dfe 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -112,6 +112,7 @@ Q_DECLARE_METATYPE(QDeclarativeProperty)
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlImportTrace, QML_IMPORT_TRACE)
+DEFINE_BOOL_CONFIG_OPTION(qmlCheckTypes, QML_CHECK_TYPES)
/*!
\qmlclass QtObject QObject
@@ -293,6 +294,10 @@ QNetworkAccessManager *QDeclarativeScriptEngine::networkAccessManager()
QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate()
{
+ Q_ASSERT(inProgressCreations == 0);
+ Q_ASSERT(bindValues.isEmpty());
+ Q_ASSERT(parserStatus.isEmpty());
+
while (cleanup) {
QDeclarativeCleanup *c = cleanup;
cleanup = c->next;
@@ -317,10 +322,6 @@ QDeclarativeEnginePrivate::~QDeclarativeEnginePrivate()
delete globalClass;
globalClass = 0;
- for(int ii = 0; ii < bindValues.count(); ++ii)
- clear(bindValues[ii]);
- for(int ii = 0; ii < parserStatus.count(); ++ii)
- clear(parserStatus[ii]);
for(QHash<int, QDeclarativeCompiledData*>::ConstIterator iter = m_compositeTypes.constBegin(); iter != m_compositeTypes.constEnd(); ++iter)
(*iter)->release();
for(QHash<const QMetaObject *, QDeclarativePropertyCache *>::Iterator iter = propertyCache.begin(); iter != propertyCache.end(); ++iter)
@@ -770,7 +771,9 @@ void QDeclarativeEngine::setObjectOwnership(QObject *object, ObjectOwnership own
if (!object)
return;
- QDeclarativeData *ddata = QDeclarativeData::get(object, true);
+ // No need to do anything if CppOwnership and there is no QDeclarativeData as
+ // the current ownership must be CppOwnership
+ QDeclarativeData *ddata = QDeclarativeData::get(object, ownership == JavaScriptOwnership);
if (!ddata)
return;
@@ -808,9 +811,6 @@ void qmlExecuteDeferred(QObject *object)
data->deferredComponent = 0;
QDeclarativeComponentPrivate::complete(ep, &state);
-
- if (!state.errors.isEmpty())
- ep->warning(state.errors);
}
}
@@ -1161,7 +1161,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr
} else if (ctxt->argument(1).isNumber()) {
enumFormat = Qt::DateFormat(ctxt->argument(1).toUInt32());
} else {
- return ctxt->throwError("Qt.formatDateTime(): Invalid datetime formate");
+ return ctxt->throwError("Qt.formatDateTime(): Invalid datetime format");
}
}
return engine->newVariant(qVariantFromValue(date.toString(enumFormat)));
@@ -1543,55 +1543,65 @@ struct QDeclarativeEnginePrivate::ImportedNamespace {
QList<bool> isLibrary;
QList<QDeclarativeDirComponents> qmlDirComponents;
- bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, QUrl* url_return,
- QUrl *base = 0)
+
+ bool find_helper(int i, const QByteArray& type, int *vmajor, int *vminor,
+ QDeclarativeType** type_return, QUrl* url_return,
+ QUrl *base = 0, bool *typeRecursionDetected = 0)
{
- for (int i=0; i<urls.count(); ++i) {
- int vmaj = majversions.at(i);
- int vmin = minversions.at(i);
-
- QByteArray qt = uris.at(i).toUtf8();
- qt += '/';
- qt += type;
-
- QDeclarativeType *t = QDeclarativeMetaType::qmlType(qt,vmaj,vmin);
- if (t) {
- if (vmajor) *vmajor = vmaj;
- if (vminor) *vminor = vmin;
- if (type_return)
- *type_return = t;
- return true;
- }
+ int vmaj = majversions.at(i);
+ int vmin = minversions.at(i);
+
+ QByteArray qt = uris.at(i).toUtf8();
+ qt += '/';
+ qt += type;
+
+ QDeclarativeType *t = QDeclarativeMetaType::qmlType(qt,vmaj,vmin);
+ if (t) {
+ if (vmajor) *vmajor = vmaj;
+ if (vminor) *vminor = vmin;
+ if (type_return)
+ *type_return = t;
+ return true;
+ }
- QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
- QDeclarativeDirComponents qmldircomponents = qmlDirComponents.at(i);
-
- bool typeWasDeclaredInQmldir = false;
- if (!qmldircomponents.isEmpty()) {
- const QString typeName = QString::fromUtf8(type);
- foreach (const QDeclarativeDirParser::Component &c, qmldircomponents) {
- if (c.typeName == typeName) {
- typeWasDeclaredInQmldir = true;
-
- // importing version -1 means import ALL versions
- if ((vmaj == -1) || (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion))) {
- QUrl candidate = url.resolved(QUrl(c.fileName));
- if (c.internal && base) {
- if (base->resolved(QUrl(c.fileName)) != candidate)
- continue; // failed attempt to access an internal type
- }
- if (url_return)
- *url_return = candidate;
- return true;
+ QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
+ QDeclarativeDirComponents qmldircomponents = qmlDirComponents.at(i);
+
+ bool typeWasDeclaredInQmldir = false;
+ if (!qmldircomponents.isEmpty()) {
+ const QString typeName = QString::fromUtf8(type);
+ foreach (const QDeclarativeDirParser::Component &c, qmldircomponents) {
+ if (c.typeName == typeName) {
+ typeWasDeclaredInQmldir = true;
+
+ // importing version -1 means import ALL versions
+ if ((vmaj == -1) || (c.majorVersion < vmaj || (c.majorVersion == vmaj && vmin >= c.minorVersion))) {
+ QUrl candidate = url.resolved(QUrl(c.fileName));
+ if (c.internal && base) {
+ if (base->resolved(QUrl(c.fileName)) != candidate)
+ continue; // failed attempt to access an internal type
}
+ if (base && *base == candidate) {
+ if (typeRecursionDetected)
+ *typeRecursionDetected = true;
+ continue; // no recursion
+ }
+ if (url_return)
+ *url_return = candidate;
+ return true;
}
}
}
+ }
- if (!typeWasDeclaredInQmldir && !isLibrary.at(i)) {
- // XXX search non-files too! (eg. zip files, see QT-524)
- QFileInfo f(toLocalFileOrQrc(url));
- if (f.exists()) {
+ if (!typeWasDeclaredInQmldir && !isLibrary.at(i)) {
+ // XXX search non-files too! (eg. zip files, see QT-524)
+ QFileInfo f(toLocalFileOrQrc(url));
+ if (f.exists()) {
+ if (base && *base == url) { // no recursion
+ if (typeRecursionDetected)
+ *typeRecursionDetected = true;
+ } else {
if (url_return)
*url_return = url;
return true;
@@ -1600,6 +1610,63 @@ struct QDeclarativeEnginePrivate::ImportedNamespace {
}
return false;
}
+
+ bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
+ QUrl* url_return, QUrl *base = 0, QString *errorString = 0)
+ {
+ bool typeRecursionDetected = false;
+ for (int i=0; i<urls.count(); ++i) {
+ if (find_helper(i, type, vmajor, vminor, type_return, url_return, base, &typeRecursionDetected)) {
+ if (qmlCheckTypes()) {
+ // check for type clashes
+ for (int j = i+1; j<urls.count(); ++j) {
+ if (find_helper(j, type, vmajor, vminor, 0, 0, base)) {
+ if (errorString) {
+ QString u1 = urls.at(i);
+ QString u2 = urls.at(j);
+ if (base) {
+ QString b = base->toString();
+ int slash = b.lastIndexOf(QLatin1Char('/'));
+ if (slash >= 0) {
+ b = b.left(slash+1);
+ QString l = b.left(slash);
+ if (u1.startsWith(b))
+ u1 = u1.mid(b.count());
+ else if (u1 == l)
+ u1 = QDeclarativeEngine::tr("local directory");
+ if (u2.startsWith(b))
+ u2 = u2.mid(b.count());
+ else if (u2 == l)
+ u2 = QDeclarativeEngine::tr("local directory");
+ }
+ }
+
+ if (u1 != u2)
+ *errorString
+ = QDeclarativeEngine::tr("is ambiguous. Found in %1 and in %2")
+ .arg(u1).arg(u2);
+ else
+ *errorString
+ = QDeclarativeEngine::tr("is ambiguous. Found in %1 in version %2.%3 and %4.%5")
+ .arg(u1)
+ .arg(majversions.at(i)).arg(minversions.at(i))
+ .arg(majversions.at(j)).arg(minversions.at(j));
+ }
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ }
+ if (errorString) {
+ if (typeRecursionDetected)
+ *errorString = QDeclarativeEngine::tr("is instantiated recursively");
+ else
+ *errorString = QDeclarativeEngine::tr("is not a type");
+ }
+ return false;
+ }
};
static bool greaterThan(const QString &s1, const QString &s2)
@@ -1809,30 +1876,37 @@ public:
return true;
}
- bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return, QUrl* url_return)
+ bool find(const QByteArray& type, int *vmajor, int *vminor, QDeclarativeType** type_return,
+ QUrl* url_return, QString *errorString)
{
QDeclarativeEnginePrivate::ImportedNamespace *s = 0;
int slash = type.indexOf('/');
if (slash >= 0) {
- s = set.value(QString::fromUtf8(type.left(slash)));
- if (!s)
- return false; // qualifier must be a namespace
+ QString namespaceName = QString::fromUtf8(type.left(slash));
+ s = set.value(namespaceName);
+ if (!s) {
+ if (errorString)
+ *errorString = QDeclarativeEngine::tr("- %1 is not a namespace").arg(namespaceName);
+ return false;
+ }
int nslash = type.indexOf('/',slash+1);
- if (nslash > 0)
- return false; // only single qualification allowed
+ if (nslash > 0) {
+ if (errorString)
+ *errorString = QDeclarativeEngine::tr("- nested namespaces not allowed");
+ return false;
+ }
} else {
s = &unqualifiedset;
}
QByteArray unqualifiedtype = slash < 0 ? type : type.mid(slash+1); // common-case opt (QString::mid works fine, but slower)
if (s) {
- if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return, &base))
+ if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return, &base, errorString))
return true;
if (s->urls.count() == 1 && !s->isLibrary[0] && url_return && s != &unqualifiedset) {
// qualified, and only 1 url
*url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
return true;
}
-
}
return false;
@@ -2329,7 +2403,7 @@ bool QDeclarativeEnginePrivate::addToImport(Imports* imports, const QDeclarative
\sa addToImport()
*/
-bool QDeclarativeEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return) const
+bool QDeclarativeEnginePrivate::resolveType(const Imports& imports, const QByteArray& type, QDeclarativeType** type_return, QUrl* url_return, int *vmaj, int *vmin, ImportedNamespace** ns_return, QString *errorString) const
{
ImportedNamespace* ns = imports.d->findNamespace(QString::fromUtf8(type));
if (ns) {
@@ -2338,7 +2412,7 @@ bool QDeclarativeEnginePrivate::resolveType(const Imports& imports, const QByteA
return true;
}
if (type_return || url_return) {
- if (imports.d->find(type,vmaj,vmin,type_return,url_return)) {
+ if (imports.d->find(type,vmaj,vmin,type_return,url_return, errorString)) {
if (qmlImportTrace()) {
if (type_return && *type_return && url_return && !url_return->isEmpty())
qDebug() << "QDeclarativeEngine::resolveType" << type << '=' << (*type_return)->typeName() << *url_return;
diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h
index f6b9bcb..743275e 100644
--- a/src/declarative/qml/qdeclarativeengine_p.h
+++ b/src/declarative/qml/qdeclarativeengine_p.h
@@ -290,7 +290,8 @@ public:
bool resolveType(const Imports&, const QByteArray& type,
QDeclarativeType** type_return, QUrl* url_return,
int *version_major, int *version_minor,
- ImportedNamespace** ns_return) const;
+ ImportedNamespace** ns_return,
+ QString *errorString = 0) const;
void resolveTypeInNamespace(ImportedNamespace*, const QByteArray& type,
QDeclarativeType** type_return, QUrl* url_return,
int *version_major, int *version_minor ) const;
diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp
index 863bfc4..2c15385 100644
--- a/src/declarative/qml/qdeclarativeextensionplugin.cpp
+++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp
@@ -64,8 +64,11 @@ QT_BEGIN_NAMESPACE
as any manipulation of the engine's root context may cause conflicts
or other issues in the library user's code.
- See \l {Extending QML in C++} for details how to write a QML extension plugin.
- See \l {How to Create Qt Plugins} for general Qt plugin documentation.
+ See \l {Tutorial: Writing QML extensions with C++} for details on creating
+ QML extensions, including how to build a plugin with with QDeclarativeExtensionPlugin.
+ For a simple overview, see the \l{declarative/plugins}{plugins} example.
+
+ Also see \l {How to Create Qt Plugins} for general Qt plugin documentation.
\sa QDeclarativeEngine::importPlugin()
*/
@@ -73,8 +76,12 @@ QT_BEGIN_NAMESPACE
/*!
\fn void QDeclarativeExtensionPlugin::registerTypes(const char *uri)
- Registers the QML types in the given \a uri. Here you call qmlRegisterType() for
- all types which are provided by the extension plugin.
+ Registers the QML types in the given \a uri. Subclasses should implement
+ this to call qmlRegisterType() for all types which are provided by the extension
+ plugin.
+
+ The \a uri is an identifier for the plugin generated by the QML engine
+ based on the name and path of the extension's plugin library.
*/
/*!
diff --git a/src/declarative/qml/qdeclarativemetatype.cpp b/src/declarative/qml/qdeclarativemetatype.cpp
index d9ea8dc..5fcb7ee 100644
--- a/src/declarative/qml/qdeclarativemetatype.cpp
+++ b/src/declarative/qml/qdeclarativemetatype.cpp
@@ -247,7 +247,7 @@ static void clone(QMetaObjectBuilder &builder, const QMetaObject *mo,
QMetaProperty property = mo->property(ii);
int otherIndex = ignoreEnd->indexOfProperty(property.name());
- if (otherIndex >= ignoreStart->classInfoOffset() + ignoreStart->classInfoCount()) {
+ if (otherIndex >= ignoreStart->propertyOffset() + ignoreStart->propertyCount()) {
builder.addProperty(QByteArray("__qml_ignore__") + property.name(), QByteArray("void"));
// Skip
} else {
diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
index b116129..399831d 100644
--- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
+++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp
@@ -59,10 +59,6 @@ QT_BEGIN_NAMESPACE
To use a factory, assign it to the relevant QDeclarativeEngine using
QDeclarativeEngine::setNetworkAccessManagerFactory().
- If the created QNetworkAccessManager becomes invalid, due to a
- change in proxy settings, for example, call the invalidate() method.
- This will cause all QNetworkAccessManagers to be recreated.
-
Note: the create() method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
@@ -82,7 +78,10 @@ QDeclarativeNetworkAccessManagerFactory::~QDeclarativeNetworkAccessManagerFactor
Implement this method to create a QNetworkAccessManager with \a parent.
This allows proxies, caching and cookie support to be setup appropriately.
- This method should return a new QNetworkAccessManager each time it is called.
+ This method must return a new QNetworkAccessManager each time it is called.
+ The parent of the QNetworkAccessManager must be the \a parent provided.
+ The QNetworkAccessManager(s) created by this
+ function will be destroyed automatically when their parent is destroyed.
Note: this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp
index e7c8a12..8b96733 100644
--- a/src/declarative/qml/qdeclarativescriptparser.cpp
+++ b/src/declarative/qml/qdeclarativescriptparser.cpp
@@ -449,6 +449,14 @@ bool ProcessAST::visit(AST::UiImport *node)
_parser->_errors << error;
return false;
}
+ if (import.qualifier == QLatin1String("Qt")) {
+ QDeclarativeError error;
+ error.setDescription(QCoreApplication::translate("QDeclarativeParser","Reserved name \"Qt\" cannot be used as an qualifier"));
+ error.setLine(node->importIdToken.startLine);
+ error.setColumn(node->importIdToken.startColumn);
+ _parser->_errors << error;
+ return false;
+ }
// Check for script qualifier clashes
bool isScript = import.type == QDeclarativeScriptParser::Import::Script;