From 1cdbd299884a2978a76d5d4bd4fccf4d64b1d708 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 17 Jan 2013 09:17:58 +0100 Subject: Remove outdated macro usage Change-Id: I4b58f3d74d7dec9a95a07b907c500990630e7762 Reviewed-by: Jerome Pasion Reviewed-by: Kai Koehne --- src/qml/qml/qqmlextensionplugin.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlextensionplugin.cpp b/src/qml/qml/qqmlextensionplugin.cpp index 9f2272a04e..291292fbbe 100644 --- a/src/qml/qml/qqmlextensionplugin.cpp +++ b/src/qml/qml/qqmlextensionplugin.cpp @@ -58,8 +58,8 @@ QT_BEGIN_NAMESPACE To write a QML extension plugin: \list - \li Subclass QQmlExtensionPlugin, implement registerTypes() method - to register types using qmlRegisterType(), and export the class using the Q_EXPORT_PLUGIN2() macro + \li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types + using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro \li Write an appropriate project file for the plugin \li Create a \l{Module Definition qmldir Files}{qmldir file} to describe the plugin \endlist @@ -140,7 +140,7 @@ QT_BEGIN_NAMESPACE Constructs a QML extension plugin with the given \a parent. Note that this constructor is invoked automatically by the - Q_EXPORT_PLUGIN2() macro, so there is no need for calling it + Q_PLUGIN_METADATA() macro, so there is no need for calling it explicitly. */ QQmlExtensionPlugin::QQmlExtensionPlugin(QObject *parent) -- cgit v1.2.3 From d4425318801c055127dba04792ebf4ef69643b6e Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Thu, 10 Jan 2013 15:47:11 +0800 Subject: Doc: Fix uses of \since Change-Id: Idf497424279fbee08e6e5750e6a15372c808105f Reviewed-by: Joerg Bornemann Reviewed-by: Jerome Pasion --- src/qml/qml/v8/qjsengine.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/qml') diff --git a/src/qml/qml/v8/qjsengine.cpp b/src/qml/qml/v8/qjsengine.cpp index acc734d549..5b1464afe6 100644 --- a/src/qml/qml/v8/qjsengine.cpp +++ b/src/qml/qml/v8/qjsengine.cpp @@ -349,7 +349,6 @@ QJSValue QJSEngine::create(int type, const void *ptr) /*! \internal - \since 4.5 convert \a value to \a type, store the result in \a ptr */ bool QJSEngine::convertV2(const QJSValue &value, int type, void *ptr) -- cgit v1.2.3 From ca711d7e6878de89ba0ae4fe6ec61d9946199fd9 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 24 Jan 2013 17:42:20 -0800 Subject: Fix memory leak The cache is filled with dynamically created entries, so clear is not quite enough. Change-Id: I40a49ce5d1a3d6da1b419e85cae95f2f95011a19 Reviewed-by: Laszlo Papp Reviewed-by: Christopher Adams --- src/qml/qml/qqmlimport.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index f2573895c6..fb4d8c007f 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1344,6 +1344,7 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e) QQmlImportDatabase::~QQmlImportDatabase() { + qDeleteAll(qmldirCache); qmldirCache.clear(); } -- cgit v1.2.3 From d005c5c80b6fff835adb350a780d80348549bc64 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 24 Jan 2013 17:31:41 -0800 Subject: Strengthen reference to var properties during construction Normally var properties are kept alive by a reference to the object they are declared on, but during the construction of that object the GC may not be aware of said object. This change uses a strong reference during GC passes which take place while the object is being constructed. Task-number: QTBUG-29138 Change-Id: Ieecfcc7567aefac0d67cb933728daf16ed3eed0a Reviewed-by: Christopher Adams --- src/qml/qml/v8/qv8engine.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qml') diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index 3fe3d28b67..2619c1a484 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -813,6 +813,12 @@ QDateTime QV8Engine::qtDateTimeFromJsDate(double jsDate) v8::Persistent *QV8Engine::findOwnerAndStrength(QObject *object, bool *shouldBeStrong) { + QQmlData *data = QQmlData::get(object); + if (data && data->rootObjectInCreation) { // When the object is still being created it may not show up to the GC. + *shouldBeStrong = true; + return 0; + } + QObject *parent = object->parent(); if (!parent) { // if the object has JS ownership, the object's v8object owns the lifetime of the persistent value. -- cgit v1.2.3 From c0c0340e4d6a6cc143299c8b10765b5f4f4cc754 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Feb 2013 16:39:22 +0100 Subject: Fix lupdate-warnings. qqmlcomponent.cpp:667: Cannot invoke tr() like this qqmltypeloader.cpp:2292: Cannot invoke tr() like this qquickloader.cpp:944: Cannot invoke tr() like this Change-Id: Ifdd1a7b958b6af88f251e7df27eb4d4018301914 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qqmlcomponent.cpp | 2 +- src/qml/qml/qqmltypeloader.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 1928bcb4b5..b335d6f402 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -664,7 +664,7 @@ void QQmlComponentPrivate::loadUrl(const QUrl &newUrl, QQmlComponent::Compilatio if (newUrl.isEmpty()) { QQmlError error; - error.setDescription(q->tr("Invalid empty URL")); + error.setDescription(QQmlComponent::tr("Invalid empty URL")); state.errors << error; return; } diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index dc63db1dea..aa7a2d95c7 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -2289,7 +2289,7 @@ void QQmlScriptBlob::done() error.setUrl(finalUrl()); error.setLine(script.location.line); error.setColumn(script.location.column); - error.setDescription(typeLoader()->tr("Script %1 unavailable").arg(script.script->url().toString())); + error.setDescription(QQmlTypeLoader::tr("Script %1 unavailable").arg(script.script->url().toString())); errors.prepend(error); setError(errors); } -- cgit v1.2.3 From 06fad3e877530eadb33d20dbf3f88c2b18c2851f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Feb 2013 16:41:17 +0100 Subject: Fix lupdate-warnings in qqmlimport.cpp. qqmlimport.cpp:738: Class 'QQmlImportsPrivate' lacks Q_OBJECT Remove tr()-function and use QQmlImportDatabase::tr() directly. Change-Id: I3a1561c57a6ee90d271a6043b0175e17a7828666 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qqmlimport.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index fb4d8c007f..52d07b23ec 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -208,10 +208,6 @@ public: QQmlTypeLoader *typeLoader; - static inline QString tr(const char *str) { - return QQmlImportDatabase::tr(str); - } - static bool locateQmldir(const QString &uri, int vmaj, int vmin, QQmlImportDatabase *database, QString *outQmldirFilePath, QString *outUrl); @@ -735,7 +731,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, // The reason is that the lower level may add url and line/column numbering information. QQmlError poppedError = errors->takeFirst(); QQmlError error; - error.setDescription(tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); + error.setDescription(QQmlImportDatabase::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(poppedError.description())); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -744,7 +740,7 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, } else { if (errors) { QQmlError error; - error.setDescription(tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name)); error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); errors->prepend(error); } @@ -1035,9 +1031,9 @@ bool QQmlImportsPrivate::addLibraryImport(const QString& uri, const QString &pre if (inserted->qmlDirComponents.isEmpty() && inserted->qmlDirScripts.isEmpty()) { QQmlError error; if (QQmlMetaType::isAnyModule(uri)) - error.setDescription(tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); else - error.setDescription(tr("module \"%1\" is not installed").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" is not installed").arg(uri)); errors->prepend(error); return false; } else if ((vmaj >= 0) && (vmin >= 0) && qmldir) { @@ -1082,7 +1078,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!QQmlFile::bundleDirectoryExists(dir, typeLoader->engine())) { if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("\"%1\": no such directory").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1107,7 +1103,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!typeLoader->directoryExists(dir)) { if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("\"%1\": no such directory").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("\"%1\": no such directory").arg(uri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1127,7 +1123,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix if (!isImplicitImport) { QQmlError error; - error.setDescription(tr("import \"%1\" has no qmldir and no namespace").arg(importUri)); + error.setDescription(QQmlImportDatabase::tr("import \"%1\" has no qmldir and no namespace").arg(importUri)); error.setUrl(QUrl(qmldirUrl)); errors->prepend(error); } @@ -1187,9 +1183,9 @@ bool QQmlImportsPrivate::updateQmldirContent(const QString &uri, const QString & if (uri != QLatin1String(".")) { QQmlError error; if (QQmlMetaType::isAnyModule(uri)) - error.setDescription(tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" version %2.%3 is not installed").arg(uri).arg(vmaj).arg(vmin)); else - error.setDescription(tr("module \"%1\" is not installed").arg(uri)); + error.setDescription(QQmlImportDatabase::tr("module \"%1\" is not installed").arg(uri)); errors->prepend(error); return false; } -- cgit v1.2.3 From c0ec84946d13e4693160e859c947696e92ef615b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Feb 2013 16:43:23 +0100 Subject: Fix lupdate-warning in qqmlrewrite.cpp. Class 'QQmlRewrite' lacks Q_OBJECT macro. Replace global-static strings by message functions. Change-Id: I67a6fbe67575533d3ce5750d72c9d7eff06e7efa Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qqmlrewrite.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlrewrite.cpp b/src/qml/qml/qqmlrewrite.cpp index 0913a8c224..0e281428ed 100644 --- a/src/qml/qml/qqmlrewrite.cpp +++ b/src/qml/qml/qqmlrewrite.cpp @@ -44,6 +44,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -513,8 +514,15 @@ bool RewriteSignalHandler::visit(AST::IdentifierExpression *e) return false; } -static QString unnamed_error_string(QLatin1String(QT_TR_NOOP("Signal uses unnamed parameter followed by named parameter."))); -static QString global_error_string(QLatin1String(QT_TR_NOOP("Signal parameter \"%1\" hides global variable."))); +static inline QString msgUnnamedErrorString() +{ + return QCoreApplication::translate("QQmlRewrite", "Signal uses unnamed parameter followed by named parameter."); +} + +static inline QString msgGlobalErrorString(const QString &p) +{ + return QCoreApplication::translate("QQmlRewrite", "Signal parameter \"%1\" hides global variable.").arg(p); +} #define EXIT_ON_ERROR(error) \ { \ @@ -543,9 +551,9 @@ QString RewriteSignalHandler::createParameterString(const QList & if (param.isEmpty()) unnamedParam = true; else if (unnamedParam) - EXIT_ON_ERROR(unnamed_error_string) + EXIT_ON_ERROR(msgUnnamedErrorString()) else if (illegalNames.contains(param)) - EXIT_ON_ERROR(global_error_string.arg(param)) + EXIT_ON_ERROR(msgGlobalErrorString(param)) ++_parameterCountForJS; parameters += param; if (i < parameterNameList.count()-1) -- cgit v1.2.3 From 34c679bc32ae98067cd1cca5564e03f629a0f3b8 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 30 Jan 2013 17:36:45 +0100 Subject: substitute fixed version numbers in qdocconf files with variables Change-Id: If28446d2d14dde62ff662ffdd366dc6384c95326 Reviewed-by: Jerome Pasion --- src/qml/doc/qtqml.qdocconf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/qml') diff --git a/src/qml/doc/qtqml.qdocconf b/src/qml/doc/qtqml.qdocconf index 5a289767ba..61d7e706ec 100644 --- a/src/qml/doc/qtqml.qdocconf +++ b/src/qml/doc/qtqml.qdocconf @@ -2,20 +2,20 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtQml description = Qt QML Reference Documentation -url = http://qt-project.org/doc/qt-5.0/qtqml -version = 5.0.1 +url = http://qt-project.org/doc/qt-$QT_VER/qtqml +version = $QT_VERSION qhp.projects = QtQml qhp.QtQml.file = qtqml.qhp -qhp.QtQml.namespace = org.qt-project.qtqml.501 +qhp.QtQml.namespace = org.qt-project.qtqml.$QT_VERSION_TAG qhp.QtQml.virtualFolder = qtqml qhp.QtQml.indexTitle = Qt QML qhp.QtQml.indexRoot = -qhp.QtQml.filterAttributes = qtqml 5.0.1 qtrefdoc -qhp.QtQml.customFilters.Qt.name = QtQml 5.0.1 -qhp.QtQml.customFilters.Qt.filterAttributes = qtqml 5.0.1 +qhp.QtQml.filterAttributes = qtqml $QT_VERSION qtrefdoc +qhp.QtQml.customFilters.Qt.name = QtQml $QT_VERSION +qhp.QtQml.customFilters.Qt.filterAttributes = qtqml $QT_VERSION qhp.QtQml.subprojects = classes examples qhp.QtQml.subprojects.classes.title = C++ Classes qhp.QtQml.subprojects.classes.indexTitle = Qt QML Module C++ Classes -- cgit v1.2.3