diff options
author | Alan Alpert <aalpert@blackberry.com> | 2013-07-05 14:31:06 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 01:08:53 +0200 |
commit | 67ee1cd27b5e951e782e49edf382e8e7d8ee431f (patch) | |
tree | ccd28910830fedd30732156d350563c5a29ed762 /examples/quick/shared | |
parent | a5052ea1e7286aee60e2e138a405d9864750db24 (diff) |
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 <lars.knoll@digia.com>
Diffstat (limited to 'examples/quick/shared')
-rw-r--r-- | examples/quick/shared/shared.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index 648b2944b7..5cf1333c02 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -40,7 +40,8 @@ #include <QDir> #include <QGuiApplication> #include <QQmlEngine> -#include <QQuickView> +#include <QQmlFileSelector> +#include <QQuickView> //Not using QQmlApplicationEngine because many examples don't have a Window{} #define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \ {\ QGuiApplication app(argc,argv);\ @@ -49,6 +50,7 @@ app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\ QQuickView view;\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ + view.engine()->setUrlInterceptor(new QQmlFileSelector(&view));\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ |