summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index 4575536..4435a5b 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -68,6 +68,7 @@
#include "qdeclarativedirparser_p.h"
#include "qdeclarativeextensioninterface.h"
#include "qdeclarativelist_p.h"
+#include "qdeclarativetypenamecache_p.h"
#include <qfxperf_p_p.h>
@@ -169,7 +170,6 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
QDeclarativeEnginePrivate::defineModule();
}
globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine);
- fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml"));
// env import paths
QByteArray envImportPath = qgetenv("QML_IMPORT_PATH");
@@ -721,6 +721,18 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre
return rv;
}
+QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
+ const QMetaObject *attachedMetaObject, bool create)
+{
+ if (*idCache == -1)
+ *idCache = QDeclarativeMetaType::attachedPropertiesFuncId(attachedMetaObject);
+
+ if (*idCache == -1 || !object)
+ return 0;
+
+ return qmlAttachedPropertiesObjectById(*idCache, object, create);
+}
+
void QDeclarativeDeclarativeData::destroyed(QObject *object)
{
if (deferredComponent)
@@ -1371,6 +1383,9 @@ public:
paths += QFileInfo(base.toLocalFile()).path();
paths += importPath;
paths += QDeclarativeEnginePrivate::get(engine)->environmentImportPath;
+ QString builtinPath = QLibraryInfo::location(QLibraryInfo::ImportsPath);
+ if (!builtinPath.isEmpty())
+ paths += builtinPath;
foreach (const QString &p, paths) {
dir = p+QLatin1Char('/')+url;
@@ -1491,9 +1506,6 @@ QDeclarativeEnginePrivate::Imports::~Imports()
delete d;
}
-#include "qdeclarativemetatype.h"
-#include "qdeclarativetypenamecache_p.h"
-
static QDeclarativeTypeNameCache *cacheForNamespace(QDeclarativeEngine *engine, const QDeclarativeEnginePrivate::ImportedNamespace &set, QDeclarativeTypeNameCache *cache)
{
if (!cache)
@@ -1582,14 +1594,17 @@ QUrl QDeclarativeEnginePrivate::Imports::baseUrl() const
Adds \a path as a directory where installed QML components are
defined in a URL-based directory structure.
- For example, if you add \c /opt/MyApp/lib/qml and then load QML
+ For example, if you add \c /opt/MyApp/lib/imports and then load QML
that imports \c com.mycompany.Feature, then QDeclarativeEngine will look
- in \c /opt/MyApp/lib/qml/com/mycompany/Feature/ for the components
- provided by that module (and in the case of versioned imports,
- for the \c qmldir file definiting the type version mapping.
+ in \c /opt/MyApp/lib/imports/com/mycompany/Feature/ for the components
+ provided by that module. A \c qmldir file is required for definiting the
+ type version mapping and possibly declarative extensions plugins.
+
+ The engine searches in the base directory of the qml file, then
+ the paths added via addImportPath(), then the paths specified in the
+ \c QML_IMPORT_PATH environment variable, then the builtin \c ImportsPath from
+ QLibraryInfo.
- By default, only the "qml" subdirectory of QLibraryInfo::location(QLibraryInfo::DataPath)
- is included on the import path.
*/
void QDeclarativeEngine::addImportPath(const QString& path)
{
@@ -1655,6 +1670,7 @@ QString QDeclarativeEnginePrivate::resolvePlugin(const QDir &dir, const QString
const QStringList &suffixes,
const QString &prefix)
{
+ qWarning() << baseName;
foreach (const QString &suffix, suffixes) {
QString pluginFileName = prefix;