summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorRobin Burchell <robin+qt@viroteck.net>2012-08-31 13:24:42 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-04 11:27:45 +0200
commitb5e6ca71283f0f68b7ba6d9fe9663650751ad43e (patch)
tree4a8c80646e34e299c3d740488231bbcd9cf3355f /src/declarative/util
parentd252cc7896200d6c82c345453fcb4d4fc3b42834 (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. (backport of qtquick1/2a3e9eb0ba00acf30b9cc40f7e2e4347726fb6b4) Change-Id: I6960e7c28bb4f153d793802b978c1944977e8ed4 Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Andy Shaw <andy.shaw@digia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativeutilmodule.cpp11
-rw-r--r--src/declarative/util/qdeclarativeutilmodule_p.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp
index 4402730d6e..29ddd26123 100644
--- a/src/declarative/util/qdeclarativeutilmodule.cpp
+++ b/src/declarative/util/qdeclarativeutilmodule.cpp
@@ -74,9 +74,9 @@
#include "private/qdeclarativexmllistmodel_p.h"
#endif
-void QDeclarativeUtilModule::defineModule(QApplication::Type appType)
+void QDeclarativeUtilModule::defineModule()
{
- if (appType != QApplication::Tty) {
+ if (QApplication::type() != QApplication::Tty) {
qmlRegisterUncreatableType<QDeclarativeApplication>("QtQuick",1,1,"Application", QDeclarativeApplication::tr("Application is an abstract class"));
qmlRegisterType<QDeclarativeAnchorAnimation>("QtQuick",1,0,"AnchorAnimation");
@@ -127,9 +127,12 @@ void QDeclarativeUtilModule::defineModule(QApplication::Type appType)
qmlRegisterCustomType<QDeclarativeConnections>("QtQuick",1,0,"Connections", new QDeclarativeConnectionsParser);
qmlRegisterCustomType<QDeclarativePropertyChanges>("QtQuick",1,0,"PropertyChanges", new QDeclarativePropertyChangesParser);
qmlRegisterCustomType<QDeclarativeListModel>("QtQuick",1,0,"ListModel", new QDeclarativeListModelParser);
+}
+void QDeclarativeUtilModule::defineModuleCompat()
+{
#ifndef QT_NO_IMPORT_QT47_QML
- if (appType != QApplication::Tty) {
+ if (QApplication::type() != QApplication::Tty) {
qmlRegisterType<QDeclarativeAnchorAnimation>("Qt",4,7,"AnchorAnimation");
qmlRegisterType<QDeclarativeAnchorChanges>("Qt",4,7,"AnchorChanges");
qmlRegisterType<QDeclarativeBehavior>("Qt",4,7,"Behavior");
@@ -162,6 +165,7 @@ void QDeclarativeUtilModule::defineModule(QApplication::Type appType)
qmlRegisterType<QDeclarativeState>("Qt",4,7,"State");
qmlRegisterType<QDeclarativeStateChangeScript>("Qt",4,7,"StateChangeScript");
qmlRegisterType<QDeclarativeListElement>("Qt",4,7,"ListElement");
+
#ifdef QT_NO_XMLPATTERNS
qmlRegisterTypeNotAvailable("Qt",4,7,"XmlListModel",
qApp->translate("QDeclarativeXmlListModel","Qt was built without support for xmlpatterns"));
@@ -176,3 +180,4 @@ void QDeclarativeUtilModule::defineModule(QApplication::Type appType)
qmlRegisterCustomType<QDeclarativeListModel>("Qt", 4,7, "ListModel", new QDeclarativeListModelParser);
#endif
}
+
diff --git a/src/declarative/util/qdeclarativeutilmodule_p.h b/src/declarative/util/qdeclarativeutilmodule_p.h
index dbd261911d..15b7d41fad 100644
--- a/src/declarative/util/qdeclarativeutilmodule_p.h
+++ b/src/declarative/util/qdeclarativeutilmodule_p.h
@@ -54,7 +54,8 @@ QT_MODULE(Declarative)
class QDeclarativeUtilModule
{
public:
- static void defineModule(QApplication::Type appType);
+ static void defineModule();
+ static void defineModuleCompat();
};
QT_END_NAMESPACE