summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativeengine.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-09-01 13:57:32 +0200
committerQt by Nokia <qt-info@nokia.com>2012-09-03 23:01:06 +0200
commite5b200fa06e01a7ff7b0943b9c8bca564a7320c4 (patch)
treed3f2ad1c791d96f02a6874d646a1f94779128118 /src/declarative/qml/qdeclarativeengine.cpp
parent427c66394d21e004f35c349d23b02f63014eb225 (diff)
Register Qt 4.7 import on-demand, instead of at startup.
This is a slightly less awkward approach (keeps backwards-compatibility) while speeding up startup for applications that don't use the old import path. Also prints a warning to let developers know they should migrate their code when possible. Completely disabling the Qt 4.7 import is still possible by setting QT_NO_IMPORT_QT47_QML. This takes around 10-15ms off a very simple "hello world" on my macbook. As an added bonus, forward-port a similar approach to 4.8's a26f545d8e25af74fb43d16c9afa79f6e04463e7 and don't register graphical types in a non-graphical application as someone (very naughtily) apparently forgot to get it integrated to Qt 5 first. Change-Id: I7821523750b3ab6770f367788725d0da70c5ec1f Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Alan Alpert <416365416c@gmail.com>
Diffstat (limited to 'src/declarative/qml/qdeclarativeengine.cpp')
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index bbf2b6be..b38a4991 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -188,13 +188,16 @@ void QDeclarativeEnginePrivate::defineModule()
qmlRegisterType<QObject>("QtQuick",1,0,"QtObject");
qmlRegisterType<QDeclarativeWorkerScript>("QtQuick",1,0,"WorkerScript");
+ qmlRegisterType<QDeclarativeBinding>();
+}
+
+void QDeclarativeEnginePrivate::defineModuleCompat()
+{
#ifndef QT_NO_IMPORT_QT47_QML
qmlRegisterType<QDeclarativeComponent>("Qt",4,7,"Component");
qmlRegisterType<QObject>("Qt",4,7,"QtObject");
qmlRegisterType<QDeclarativeWorkerScript>("Qt",4,7,"WorkerScript");
#endif
-
- qmlRegisterType<QDeclarativeBinding>();
}
/*!
@@ -356,10 +359,10 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e)
{
if (!qt_QmlQtModule_registered) {
qt_QmlQtModule_registered = true;
- QDeclarativeItemModule::defineModule();
- QDeclarativeUtilModule::defineModule();
QDeclarativeEnginePrivate::defineModule();
+ QDeclarativeItemModule::defineModule();
QDeclarativeValueTypeFactory::registerValueTypes();
+ QDeclarativeUtilModule::defineModule();
}
globalClass = new QDeclarativeGlobalScriptClass(&scriptEngine);
}