13 #include <QtCore/QCoreApplication>
14 #include <QtCore/QDir>
15 #include <QtQml/QQmlEngine>
21 static QString adjustPath(
const QString &path);
24 QString QtQuick2ApplicationViewerPrivate::adjustPath(
const QString &path)
27 if (!QDir::isAbsolutePath(path))
28 return QString::fromLatin1(
"%1/../Resources/%2")
29 .arg(QCoreApplication::applicationDirPath(), path);
30 #elif defined(Q_OS_BLACKBERRY)
31 if (!QDir::isAbsolutePath(path))
32 return QString::fromLatin1(
"app/native/%1").arg(path);
33 #elif !defined(Q_OS_ANDROID)
34 QString pathInInstallDir =
35 QString::fromLatin1(
"%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
36 if (QFileInfo(pathInInstallDir).exists())
37 return pathInInstallDir;
39 QString::fromLatin1(
"%1/%2").arg(QCoreApplication::applicationDirPath(), path);
40 if (QFileInfo(pathInInstallDir).exists())
41 return pathInInstallDir;
50 connect(engine(), SIGNAL(quit()), SLOT(close()));
51 setResizeMode(QQuickView::SizeRootObjectToView);
61 d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
63 setSource(QUrl(QLatin1String(
"assets:/")+d->mainQmlFile));
65 setSource(QUrl::fromLocalFile(d->mainQmlFile));
71 engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
76 #if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)