From a0fb0a5dd32b031f89abe603ed07a50c74327e37 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 11 Dec 2012 14:17:34 +0100 Subject: Use resource files for most examples Make examples shadow-build-friendly by using resource files instead of trying to derive the qml path from applicationDirPath(). Change-Id: I669424554c772d9b261249b366247190f5fbd8b1 Reviewed-by: Oliver Wolff --- examples/quick/shared/shared.h | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'examples/quick/shared/shared.h') diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index 7fd2f08a40..a7072daa89 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -45,32 +45,8 @@ {\ QGuiApplication app(argc,argv);\ QQuickView view;\ - QDir directory(QCoreApplication::applicationDirPath());\ - if (QGuiApplication::platformName() == QLatin1String("windows")) {\ - if (directory.absolutePath().endsWith("/debug", Qt::CaseInsensitive)\ - || directory.absolutePath().endsWith("/release", Qt::CaseInsensitive))\ - if (!directory.cdUp()) {\ - qWarning("Could not change to parent directory of '%s'",\ - qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ - return -1;\ - }\ - } else if (QGuiApplication::platformName() == QLatin1String("cocoa")) {\ - if (directory.absolutePath().endsWith(#NAME".app/Contents/MacOS"))\ - for (int i = 0; i < 3; ++i) {\ - if (!directory.cdUp()) {\ - qWarning("Could not change to parent directory of '%s'",\ - qPrintable(QDir::toNativeSeparators(directory.absolutePath())));\ - return -1;\ - }\ - }\ - }\ - const QString fileName(directory.absolutePath() + "/" #NAME ".qml");\ - if (!QFile::exists(fileName)) {\ - qWarning("Could not find file '%s'", qPrintable(QDir::toNativeSeparators(fileName)));\ - return -1;\ - }\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ - view.setSource(QUrl::fromLocalFile(fileName)); \ + view.setSource(QUrl("qrc:///" #NAME ".qml")); \ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ view.setResizeMode(QQuickView::SizeRootObjectToView);\ -- cgit v1.2.3