diff options
author | Robin Burchell <robin+qt@viroteck.net> | 2012-09-01 13:57:32 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-03 23:01:06 +0200 |
commit | e5b200fa06e01a7ff7b0943b9c8bca564a7320c4 (patch) | |
tree | d3f2ad1c791d96f02a6874d646a1f94779128118 /src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | |
parent | 427c66394d21e004f35c349d23b02f63014eb225 (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/graphicsitems/qdeclarativeitemsmodule.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 5a923271..d7083e1a 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -96,6 +96,9 @@ static QDeclarativePrivate::AutoParentResult qgraphicsobject_autoParent(QObject void QDeclarativeItemModule::defineModule() { + if (QApplication::type() == QApplication::Tty) + return; + QDeclarativePrivate::RegisterAutoParent autoparent = { 0, &qgraphicsobject_autoParent }; QDeclarativePrivate::qmlregister(QDeclarativePrivate::AutoParentRegistration, &autoparent); #ifdef QT_NO_MOVIE @@ -199,8 +202,13 @@ void QDeclarativeItemModule::defineModule() qmlRegisterRevision<QDeclarativeImplicitSizePaintedItem,0>("QtQuick",1,0); qmlRegisterRevision<QDeclarativeImplicitSizePaintedItem,1>("QtQuick",1,1); qmlRegisterUncreatableType<QDeclarativeLayoutMirroringAttached>("QtQuick",1,1,"LayoutMirroring", QDeclarativeLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); +} + +void QDeclarativeItemModule::defineModuleCompat() +{ + if (QApplication::type() == QApplication::Tty) + return; -#ifndef QT_NO_IMPORT_QT47_QML #ifdef QT_NO_MOVIE qmlRegisterTypeNotAvailable("Qt",4,7,"AnimatedImage", qApp->translate("QDeclarativeAnimatedImage","Qt was built without support for QMovie")); @@ -257,5 +265,5 @@ void QDeclarativeItemModule::defineModule() qmlRegisterUncreatableType<QDeclarativeKeyNavigationAttached>("Qt",4,7,"KeyNavigation",QDeclarativeKeyNavigationAttached::tr("KeyNavigation is only available via attached properties")); qmlRegisterUncreatableType<QDeclarativeKeysAttached>("Qt",4,7,"Keys",QDeclarativeKeysAttached::tr("Keys is only available via attached properties")); -#endif } + |