WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
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 
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  pathInInstallDir =
43  QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
44  if (QFileInfo(pathInInstallDir).exists())
45  return pathInInstallDir;
46 #elif defined(Q_OS_ANDROID_NO_SDK)
47  return QLatin1String("/data/user/qt/") + path;
48 #endif
49  return path;
50 }
51 
53  : QQuickView(parent)
55 {
56  connect(engine(), SIGNAL(quit()), SLOT(close()));
57  setResizeMode(QQuickView::SizeRootObjectToView);
58 }
59 
61 {
62  delete d;
63 }
64 
66 {
68 #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
69  setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
70 #else
71  setSource(QUrl::fromLocalFile(d->mainQmlFile));
72 #endif
73 }
74 
76 {
77  engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
78 }
79 
81 {
82 #if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
83  showFullScreen();
84 #else
85  show();
86 #endif
87 }
void addImportPath(const QString &path)
static QString adjustPath(const QString &path)
class QtQuick2ApplicationViewerPrivate * d
QtQuick2ApplicationViewer(QWindow *parent=0)
void setMainQmlFile(const QString &file)