aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/shared/shared.h
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@blackberry.com>2013-07-05 14:31:06 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-20 01:08:53 +0200
commit67ee1cd27b5e951e782e49edf382e8e7d8ee431f (patch)
treeccd28910830fedd30732156d350563c5a29ed762 /examples/quick/shared/shared.h
parenta5052ea1e7286aee60e2e138a405d9864750db24 (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/shared.h')
-rw-r--r--examples/quick/shared/shared.h4
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") || \