YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
qtquick2applicationviewer.cpp
Go to the documentation of this file.
1// checksum 0xc01f version 0x90005
2/*
3 This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
4 QtQuick2ApplicationViewer is a convenience class containing mobile device specific
5 code such as screen orientation handling. Also QML paths and debugging are
6 handled here.
7 It is recommended not to modify this file, since newer versions of Qt Creator
8 may offer an updated version of it.
9*/
10
12
13#include <QtCore/QCoreApplication>
14#include <QtCore/QDir>
15#include <QtQml/QQmlEngine>
16
18{
19 QString mainQmlFile;
21 static QString adjustPath(const QString &path);
22};
23
24QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
25{
26#if defined(Q_OS_IOS)
27 if (!QDir::isAbsolutePath(path))
28 return QString::fromLatin1("%1/%2")
29 .arg(QCoreApplication::applicationDirPath(), path);
30#elif defined(Q_OS_MAC)
31 if (!QDir::isAbsolutePath(path))
32 return QString::fromLatin1("%1/../Resources/%2")
33 .arg(QCoreApplication::applicationDirPath(), path);
34#elif defined(Q_OS_BLACKBERRY)
35 if (!QDir::isAbsolutePath(path))
36 return QString::fromLatin1("app/native/%1").arg(path);
37#elif !defined(Q_OS_ANDROID)
38 QString pathInInstallDir =
39 QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
40 if (QFileInfo(pathInInstallDir).exists()) {
41 return pathInInstallDir;
42 }
43 pathInInstallDir =
44 QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
45 if (QFileInfo(pathInInstallDir).exists()) {
46 return pathInInstallDir;
47 }
48#elif defined(Q_OS_ANDROID_NO_SDK)
49 return QLatin1String("/data/user/qt/") + path;
50#endif
51 return path;
52}
53
55 : QQuickView(parent)
57{
58 connect(engine(), SIGNAL(quit()), SLOT(close()));
59 setResizeMode(QQuickView::SizeRootObjectToView);
60}
61
66
68{
69 d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
70#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
71 setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
72#else
73 setSource(QUrl::fromLocalFile(d->mainQmlFile));
74#endif
75}
76
78{
79 engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
80}
81
83{
84#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
85 showFullScreen();
86#else
87 show();
88#endif
89}
int SIGNAL(int pid, int signum)
void addImportPath(const QString &path)
void setMainQmlFile(const QString &file)