From 67ee1cd27b5e951e782e49edf382e8e7d8ee431f Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 5 Jul 2013 14:31:06 -0700 Subject: Apply file selectors to QQmlApplicationEngine apps You can also manually apply them to a QQmlEngine using setUrlInterceptor(new QQmlFileSelector(parent)), or using your own QQmlAbstractUrlInterceptor subclass. Change-Id: I0c0ff8b080c138686b3c03e0bc3b9f25bcd11a85 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlapplicationengine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/qml/qml/qqmlapplicationengine.cpp') diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index 85aeaf5786..3f13f8a140 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -44,6 +44,7 @@ #include #include "qqmlapplicationengine.h" #include "qqmlapplicationengine_p.h" +#include "qqmlfileselector.h" QT_BEGIN_NAMESPACE @@ -76,6 +77,7 @@ void QQmlApplicationEnginePrivate::init() QCoreApplication::installTranslator(qtTranslator); translators << qtTranslator; #endif + q->setUrlInterceptor(new QQmlFileSelector(q)); QCoreApplication::instance()->setProperty("__qml_using_qqmlapplicationengine", QVariant(true)); } @@ -172,13 +174,12 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o) \li Connecting Qt.quit() to QCoreApplication::quit() \li Automatically loads translation files from an i18n directory adjacent to the main QML file. \li Automatically sets an incubuation controller if the scene contains a QQuickWindow. + \li Automatically sets a \c QQmlFileSelector as the url interceptor, applying file selectors to all + QML files and assets. \endlist The engine behavior can be further tweaked by using the inherited methods from QQmlEngine. - \note In the future QQmlApplicationEngine may automatically apply file selectors. - To ensure forwards compatibility, do not use folder names containing a '+' character in your QML file - structure. */ /*! -- cgit v1.2.3