summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativevaluetype.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/qdeclarativevaluetype.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/qdeclarativevaluetype.cpp')
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index c18ea9d8..6a0eac98 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -44,6 +44,7 @@
#include "private/qdeclarativemetatype_p.h"
#include "private/qfont_p.h"
+#include <QtWidgets/qapplication.h>
#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
@@ -106,10 +107,15 @@ void QDeclarativeValueTypeFactory::registerValueTypes()
{
qmlRegisterValueTypeEnums<QDeclarativeEasingValueType>("QtQuick",1,0,"Easing");
qmlRegisterValueTypeEnums<QDeclarativeFontValueType>("QtQuick",1,0,"Font");
-#ifndef QT_NO_IMPORT_QT47_QML
+}
+
+void QDeclarativeValueTypeFactory::registerValueTypesCompat()
+{
+ if (QApplication::type() == QApplication::Tty)
+ return;
+
qmlRegisterValueTypeEnums<QDeclarativeEasingValueType>("Qt",4,7,"Easing");
qmlRegisterValueTypeEnums<QDeclarativeFontValueType>("Qt",4,7,"Font");
-#endif
}
QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)