@@ -1,70 +1,87 | |||||
1 |
// checksum 0x |
|
1 | // checksum 0xc01f version 0x90005 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. |
|
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 |
|
4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific | |
5 | code such as screen orientation handling. Also QML paths and debugging are |
|
5 | code such as screen orientation handling. Also QML paths and debugging are | |
6 | handled here. |
|
6 | handled here. | |
7 | It is recommended not to modify this file, since newer versions of Qt Creator |
|
7 | It is recommended not to modify this file, since newer versions of Qt Creator | |
8 | may offer an updated version of it. |
|
8 | may offer an updated version of it. | |
9 | */ |
|
9 | */ | |
10 |
|
10 | |||
11 | #include "qtquick2applicationviewer.h" |
|
11 | #include "qtquick2applicationviewer.h" | |
12 |
|
12 | |||
13 | #include <QtCore/QCoreApplication> |
|
13 | #include <QtCore/QCoreApplication> | |
14 | #include <QtCore/QDir> |
|
14 | #include <QtCore/QDir> | |
15 | #include <QtQml/QQmlEngine> |
|
15 | #include <QtQml/QQmlEngine> | |
16 |
|
16 | |||
17 | class QtQuick2ApplicationViewerPrivate |
|
17 | class QtQuick2ApplicationViewerPrivate | |
18 | { |
|
18 | { | |
19 | QString mainQmlFile; |
|
19 | QString mainQmlFile; | |
20 | friend class QtQuick2ApplicationViewer; |
|
20 | friend class QtQuick2ApplicationViewer; | |
21 | static QString adjustPath(const QString &path); |
|
21 | static QString adjustPath(const QString &path); | |
22 | }; |
|
22 | }; | |
23 |
|
23 | |||
24 | QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) |
|
24 | QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) | |
25 | { |
|
25 | { | |
26 |
#if defined(Q_OS_ |
|
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) | |||
27 | if (!QDir::isAbsolutePath(path)) |
|
31 | if (!QDir::isAbsolutePath(path)) | |
28 | return QString::fromLatin1("%1/../Resources/%2") |
|
32 | return QString::fromLatin1("%1/../Resources/%2") | |
29 | .arg(QCoreApplication::applicationDirPath(), path); |
|
33 | .arg(QCoreApplication::applicationDirPath(), path); | |
30 |
#elif defined(Q_OS_ |
|
34 | #elif defined(Q_OS_BLACKBERRY) | |
31 | const QString pathInInstallDir = |
|
35 | if (!QDir::isAbsolutePath(path)) | |
|
36 | return QString::fromLatin1("app/native/%1").arg(path); | |||
|
37 | #elif !defined(Q_OS_ANDROID) | |||
|
38 | QString pathInInstallDir = | |||
32 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); |
|
39 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
33 | if (QFileInfo(pathInInstallDir).exists()) |
|
40 | if (QFileInfo(pathInInstallDir).exists()) | |
34 | return pathInInstallDir; |
|
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; | |||
35 | #endif |
|
48 | #endif | |
36 | return path; |
|
49 | return path; | |
37 | } |
|
50 | } | |
38 |
|
51 | |||
39 | QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) |
|
52 | QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) | |
40 | : QQuickView(parent) |
|
53 | : QQuickView(parent) | |
41 | , d(new QtQuick2ApplicationViewerPrivate()) |
|
54 | , d(new QtQuick2ApplicationViewerPrivate()) | |
42 | { |
|
55 | { | |
43 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
56 | connect(engine(), SIGNAL(quit()), SLOT(close())); | |
44 | setResizeMode(QQuickView::SizeRootObjectToView); |
|
57 | setResizeMode(QQuickView::SizeRootObjectToView); | |
45 | } |
|
58 | } | |
46 |
|
59 | |||
47 | QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() |
|
60 | QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() | |
48 | { |
|
61 | { | |
49 | delete d; |
|
62 | delete d; | |
50 | } |
|
63 | } | |
51 |
|
64 | |||
52 | void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) |
|
65 | void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) | |
53 | { |
|
66 | { | |
54 | d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); |
|
67 | d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); | |
|
68 | #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) | |||
|
69 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |||
|
70 | #else | |||
55 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); |
|
71 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
72 | #endif | |||
56 | } |
|
73 | } | |
57 |
|
74 | |||
58 | void QtQuick2ApplicationViewer::addImportPath(const QString &path) |
|
75 | void QtQuick2ApplicationViewer::addImportPath(const QString &path) | |
59 | { |
|
76 | { | |
60 | engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); |
|
77 | engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); | |
61 | } |
|
78 | } | |
62 |
|
79 | |||
63 | void QtQuick2ApplicationViewer::showExpanded() |
|
80 | void QtQuick2ApplicationViewer::showExpanded() | |
64 | { |
|
81 | { | |
65 | #if defined(Q_WS_SIMULATOR) |
|
82 | #if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX) | |
66 | showFullScreen(); |
|
83 | showFullScreen(); | |
67 | #else |
|
84 | #else | |
68 | show(); |
|
85 | show(); | |
69 | #endif |
|
86 | #endif | |
70 | } |
|
87 | } |
@@ -1,33 +1,33 | |||||
1 |
// checksum 0xfde6 version 0x |
|
1 | // checksum 0xfde6 version 0x90005 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. |
|
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 |
|
4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific | |
5 | code such as screen orientation handling. Also QML paths and debugging are |
|
5 | code such as screen orientation handling. Also QML paths and debugging are | |
6 | handled here. |
|
6 | handled here. | |
7 | It is recommended not to modify this file, since newer versions of Qt Creator |
|
7 | It is recommended not to modify this file, since newer versions of Qt Creator | |
8 | may offer an updated version of it. |
|
8 | may offer an updated version of it. | |
9 | */ |
|
9 | */ | |
10 |
|
10 | |||
11 | #ifndef QTQUICK2APPLICATIONVIEWER_H |
|
11 | #ifndef QTQUICK2APPLICATIONVIEWER_H | |
12 | #define QTQUICK2APPLICATIONVIEWER_H |
|
12 | #define QTQUICK2APPLICATIONVIEWER_H | |
13 |
|
13 | |||
14 | #include <QtQuick/QQuickView> |
|
14 | #include <QtQuick/QQuickView> | |
15 |
|
15 | |||
16 | class QtQuick2ApplicationViewer : public QQuickView |
|
16 | class QtQuick2ApplicationViewer : public QQuickView | |
17 | { |
|
17 | { | |
18 | Q_OBJECT |
|
18 | Q_OBJECT | |
19 |
|
19 | |||
20 | public: |
|
20 | public: | |
21 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); |
|
21 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); | |
22 | virtual ~QtQuick2ApplicationViewer(); |
|
22 | virtual ~QtQuick2ApplicationViewer(); | |
23 |
|
23 | |||
24 | void setMainQmlFile(const QString &file); |
|
24 | void setMainQmlFile(const QString &file); | |
25 | void addImportPath(const QString &path); |
|
25 | void addImportPath(const QString &path); | |
26 |
|
26 | |||
27 | void showExpanded(); |
|
27 | void showExpanded(); | |
28 |
|
28 | |||
29 | private: |
|
29 | private: | |
30 | class QtQuick2ApplicationViewerPrivate *d; |
|
30 | class QtQuick2ApplicationViewerPrivate *d; | |
31 | }; |
|
31 | }; | |
32 |
|
32 | |||
33 | #endif // QTQUICK2APPLICATIONVIEWER_H |
|
33 | #endif // QTQUICK2APPLICATIONVIEWER_H |
@@ -1,70 +1,87 | |||||
1 |
// checksum 0x |
|
1 | // checksum 0xc01f version 0x90005 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. |
|
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 |
|
4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific | |
5 | code such as screen orientation handling. Also QML paths and debugging are |
|
5 | code such as screen orientation handling. Also QML paths and debugging are | |
6 | handled here. |
|
6 | handled here. | |
7 | It is recommended not to modify this file, since newer versions of Qt Creator |
|
7 | It is recommended not to modify this file, since newer versions of Qt Creator | |
8 | may offer an updated version of it. |
|
8 | may offer an updated version of it. | |
9 | */ |
|
9 | */ | |
10 |
|
10 | |||
11 | #include "qtquick2applicationviewer.h" |
|
11 | #include "qtquick2applicationviewer.h" | |
12 |
|
12 | |||
13 | #include <QtCore/QCoreApplication> |
|
13 | #include <QtCore/QCoreApplication> | |
14 | #include <QtCore/QDir> |
|
14 | #include <QtCore/QDir> | |
15 | #include <QtQml/QQmlEngine> |
|
15 | #include <QtQml/QQmlEngine> | |
16 |
|
16 | |||
17 | class QtQuick2ApplicationViewerPrivate |
|
17 | class QtQuick2ApplicationViewerPrivate | |
18 | { |
|
18 | { | |
19 | QString mainQmlFile; |
|
19 | QString mainQmlFile; | |
20 | friend class QtQuick2ApplicationViewer; |
|
20 | friend class QtQuick2ApplicationViewer; | |
21 | static QString adjustPath(const QString &path); |
|
21 | static QString adjustPath(const QString &path); | |
22 | }; |
|
22 | }; | |
23 |
|
23 | |||
24 | QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) |
|
24 | QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) | |
25 | { |
|
25 | { | |
26 |
#if defined(Q_OS_ |
|
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) | |||
27 | if (!QDir::isAbsolutePath(path)) |
|
31 | if (!QDir::isAbsolutePath(path)) | |
28 | return QString::fromLatin1("%1/../Resources/%2") |
|
32 | return QString::fromLatin1("%1/../Resources/%2") | |
29 | .arg(QCoreApplication::applicationDirPath(), path); |
|
33 | .arg(QCoreApplication::applicationDirPath(), path); | |
30 |
#elif defined(Q_OS_ |
|
34 | #elif defined(Q_OS_BLACKBERRY) | |
31 | const QString pathInInstallDir = |
|
35 | if (!QDir::isAbsolutePath(path)) | |
|
36 | return QString::fromLatin1("app/native/%1").arg(path); | |||
|
37 | #elif !defined(Q_OS_ANDROID) | |||
|
38 | QString pathInInstallDir = | |||
32 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); |
|
39 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
33 | if (QFileInfo(pathInInstallDir).exists()) |
|
40 | if (QFileInfo(pathInInstallDir).exists()) | |
34 | return pathInInstallDir; |
|
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; | |||
35 | #endif |
|
48 | #endif | |
36 | return path; |
|
49 | return path; | |
37 | } |
|
50 | } | |
38 |
|
51 | |||
39 | QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) |
|
52 | QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) | |
40 | : QQuickView(parent) |
|
53 | : QQuickView(parent) | |
41 | , d(new QtQuick2ApplicationViewerPrivate()) |
|
54 | , d(new QtQuick2ApplicationViewerPrivate()) | |
42 | { |
|
55 | { | |
43 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
56 | connect(engine(), SIGNAL(quit()), SLOT(close())); | |
44 | setResizeMode(QQuickView::SizeRootObjectToView); |
|
57 | setResizeMode(QQuickView::SizeRootObjectToView); | |
45 | } |
|
58 | } | |
46 |
|
59 | |||
47 | QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() |
|
60 | QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() | |
48 | { |
|
61 | { | |
49 | delete d; |
|
62 | delete d; | |
50 | } |
|
63 | } | |
51 |
|
64 | |||
52 | void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) |
|
65 | void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) | |
53 | { |
|
66 | { | |
54 | d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); |
|
67 | d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); | |
|
68 | #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) | |||
|
69 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |||
|
70 | #else | |||
55 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); |
|
71 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
72 | #endif | |||
56 | } |
|
73 | } | |
57 |
|
74 | |||
58 | void QtQuick2ApplicationViewer::addImportPath(const QString &path) |
|
75 | void QtQuick2ApplicationViewer::addImportPath(const QString &path) | |
59 | { |
|
76 | { | |
60 | engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); |
|
77 | engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); | |
61 | } |
|
78 | } | |
62 |
|
79 | |||
63 | void QtQuick2ApplicationViewer::showExpanded() |
|
80 | void QtQuick2ApplicationViewer::showExpanded() | |
64 | { |
|
81 | { | |
65 | #if defined(Q_WS_SIMULATOR) |
|
82 | #if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX) | |
66 | showFullScreen(); |
|
83 | showFullScreen(); | |
67 | #else |
|
84 | #else | |
68 | show(); |
|
85 | show(); | |
69 | #endif |
|
86 | #endif | |
70 | } |
|
87 | } |
@@ -1,33 +1,33 | |||||
1 |
// checksum 0xfde6 version 0x |
|
1 | // checksum 0xfde6 version 0x90005 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. |
|
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 |
|
4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific | |
5 | code such as screen orientation handling. Also QML paths and debugging are |
|
5 | code such as screen orientation handling. Also QML paths and debugging are | |
6 | handled here. |
|
6 | handled here. | |
7 | It is recommended not to modify this file, since newer versions of Qt Creator |
|
7 | It is recommended not to modify this file, since newer versions of Qt Creator | |
8 | may offer an updated version of it. |
|
8 | may offer an updated version of it. | |
9 | */ |
|
9 | */ | |
10 |
|
10 | |||
11 | #ifndef QTQUICK2APPLICATIONVIEWER_H |
|
11 | #ifndef QTQUICK2APPLICATIONVIEWER_H | |
12 | #define QTQUICK2APPLICATIONVIEWER_H |
|
12 | #define QTQUICK2APPLICATIONVIEWER_H | |
13 |
|
13 | |||
14 | #include <QtQuick/QQuickView> |
|
14 | #include <QtQuick/QQuickView> | |
15 |
|
15 | |||
16 | class QtQuick2ApplicationViewer : public QQuickView |
|
16 | class QtQuick2ApplicationViewer : public QQuickView | |
17 | { |
|
17 | { | |
18 | Q_OBJECT |
|
18 | Q_OBJECT | |
19 |
|
19 | |||
20 | public: |
|
20 | public: | |
21 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); |
|
21 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); | |
22 | virtual ~QtQuick2ApplicationViewer(); |
|
22 | virtual ~QtQuick2ApplicationViewer(); | |
23 |
|
23 | |||
24 | void setMainQmlFile(const QString &file); |
|
24 | void setMainQmlFile(const QString &file); | |
25 | void addImportPath(const QString &path); |
|
25 | void addImportPath(const QString &path); | |
26 |
|
26 | |||
27 | void showExpanded(); |
|
27 | void showExpanded(); | |
28 |
|
28 | |||
29 | private: |
|
29 | private: | |
30 | class QtQuick2ApplicationViewerPrivate *d; |
|
30 | class QtQuick2ApplicationViewerPrivate *d; | |
31 | }; |
|
31 | }; | |
32 |
|
32 | |||
33 | #endif // QTQUICK2APPLICATIONVIEWER_H |
|
33 | #endif // QTQUICK2APPLICATIONVIEWER_H |
@@ -1,70 +1,87 | |||||
1 |
// checksum 0x |
|
1 | // checksum 0xc01f version 0x90005 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. |
|
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 |
|
4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific | |
5 | code such as screen orientation handling. Also QML paths and debugging are |
|
5 | code such as screen orientation handling. Also QML paths and debugging are | |
6 | handled here. |
|
6 | handled here. | |
7 | It is recommended not to modify this file, since newer versions of Qt Creator |
|
7 | It is recommended not to modify this file, since newer versions of Qt Creator | |
8 | may offer an updated version of it. |
|
8 | may offer an updated version of it. | |
9 | */ |
|
9 | */ | |
10 |
|
10 | |||
11 | #include "qtquick2applicationviewer.h" |
|
11 | #include "qtquick2applicationviewer.h" | |
12 |
|
12 | |||
13 | #include <QtCore/QCoreApplication> |
|
13 | #include <QtCore/QCoreApplication> | |
14 | #include <QtCore/QDir> |
|
14 | #include <QtCore/QDir> | |
15 | #include <QtQml/QQmlEngine> |
|
15 | #include <QtQml/QQmlEngine> | |
16 |
|
16 | |||
17 | class QtQuick2ApplicationViewerPrivate |
|
17 | class QtQuick2ApplicationViewerPrivate | |
18 | { |
|
18 | { | |
19 | QString mainQmlFile; |
|
19 | QString mainQmlFile; | |
20 | friend class QtQuick2ApplicationViewer; |
|
20 | friend class QtQuick2ApplicationViewer; | |
21 | static QString adjustPath(const QString &path); |
|
21 | static QString adjustPath(const QString &path); | |
22 | }; |
|
22 | }; | |
23 |
|
23 | |||
24 | QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) |
|
24 | QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path) | |
25 | { |
|
25 | { | |
26 |
#if defined(Q_OS_ |
|
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) | |||
27 | if (!QDir::isAbsolutePath(path)) |
|
31 | if (!QDir::isAbsolutePath(path)) | |
28 | return QString::fromLatin1("%1/../Resources/%2") |
|
32 | return QString::fromLatin1("%1/../Resources/%2") | |
29 | .arg(QCoreApplication::applicationDirPath(), path); |
|
33 | .arg(QCoreApplication::applicationDirPath(), path); | |
30 |
#elif defined(Q_OS_ |
|
34 | #elif defined(Q_OS_BLACKBERRY) | |
31 | const QString pathInInstallDir = |
|
35 | if (!QDir::isAbsolutePath(path)) | |
|
36 | return QString::fromLatin1("app/native/%1").arg(path); | |||
|
37 | #elif !defined(Q_OS_ANDROID) | |||
|
38 | QString pathInInstallDir = | |||
32 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); |
|
39 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
33 | if (QFileInfo(pathInInstallDir).exists()) |
|
40 | if (QFileInfo(pathInInstallDir).exists()) | |
34 | return pathInInstallDir; |
|
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; | |||
35 | #endif |
|
48 | #endif | |
36 | return path; |
|
49 | return path; | |
37 | } |
|
50 | } | |
38 |
|
51 | |||
39 | QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) |
|
52 | QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent) | |
40 | : QQuickView(parent) |
|
53 | : QQuickView(parent) | |
41 | , d(new QtQuick2ApplicationViewerPrivate()) |
|
54 | , d(new QtQuick2ApplicationViewerPrivate()) | |
42 | { |
|
55 | { | |
43 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
56 | connect(engine(), SIGNAL(quit()), SLOT(close())); | |
44 | setResizeMode(QQuickView::SizeRootObjectToView); |
|
57 | setResizeMode(QQuickView::SizeRootObjectToView); | |
45 | } |
|
58 | } | |
46 |
|
59 | |||
47 | QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() |
|
60 | QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() | |
48 | { |
|
61 | { | |
49 | delete d; |
|
62 | delete d; | |
50 | } |
|
63 | } | |
51 |
|
64 | |||
52 | void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) |
|
65 | void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file) | |
53 | { |
|
66 | { | |
54 | d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); |
|
67 | d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); | |
|
68 | #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) | |||
|
69 | setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile)); | |||
|
70 | #else | |||
55 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); |
|
71 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
72 | #endif | |||
56 | } |
|
73 | } | |
57 |
|
74 | |||
58 | void QtQuick2ApplicationViewer::addImportPath(const QString &path) |
|
75 | void QtQuick2ApplicationViewer::addImportPath(const QString &path) | |
59 | { |
|
76 | { | |
60 | engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); |
|
77 | engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); | |
61 | } |
|
78 | } | |
62 |
|
79 | |||
63 | void QtQuick2ApplicationViewer::showExpanded() |
|
80 | void QtQuick2ApplicationViewer::showExpanded() | |
64 | { |
|
81 | { | |
65 | #if defined(Q_WS_SIMULATOR) |
|
82 | #if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX) | |
66 | showFullScreen(); |
|
83 | showFullScreen(); | |
67 | #else |
|
84 | #else | |
68 | show(); |
|
85 | show(); | |
69 | #endif |
|
86 | #endif | |
70 | } |
|
87 | } |
@@ -1,33 +1,33 | |||||
1 |
// checksum 0xfde6 version 0x |
|
1 | // checksum 0xfde6 version 0x90005 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick 2 Application wizard of Qt Creator. |
|
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 |
|
4 | QtQuick2ApplicationViewer is a convenience class containing mobile device specific | |
5 | code such as screen orientation handling. Also QML paths and debugging are |
|
5 | code such as screen orientation handling. Also QML paths and debugging are | |
6 | handled here. |
|
6 | handled here. | |
7 | It is recommended not to modify this file, since newer versions of Qt Creator |
|
7 | It is recommended not to modify this file, since newer versions of Qt Creator | |
8 | may offer an updated version of it. |
|
8 | may offer an updated version of it. | |
9 | */ |
|
9 | */ | |
10 |
|
10 | |||
11 | #ifndef QTQUICK2APPLICATIONVIEWER_H |
|
11 | #ifndef QTQUICK2APPLICATIONVIEWER_H | |
12 | #define QTQUICK2APPLICATIONVIEWER_H |
|
12 | #define QTQUICK2APPLICATIONVIEWER_H | |
13 |
|
13 | |||
14 | #include <QtQuick/QQuickView> |
|
14 | #include <QtQuick/QQuickView> | |
15 |
|
15 | |||
16 | class QtQuick2ApplicationViewer : public QQuickView |
|
16 | class QtQuick2ApplicationViewer : public QQuickView | |
17 | { |
|
17 | { | |
18 | Q_OBJECT |
|
18 | Q_OBJECT | |
19 |
|
19 | |||
20 | public: |
|
20 | public: | |
21 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); |
|
21 | explicit QtQuick2ApplicationViewer(QWindow *parent = 0); | |
22 | virtual ~QtQuick2ApplicationViewer(); |
|
22 | virtual ~QtQuick2ApplicationViewer(); | |
23 |
|
23 | |||
24 | void setMainQmlFile(const QString &file); |
|
24 | void setMainQmlFile(const QString &file); | |
25 | void addImportPath(const QString &path); |
|
25 | void addImportPath(const QString &path); | |
26 |
|
26 | |||
27 | void showExpanded(); |
|
27 | void showExpanded(); | |
28 |
|
28 | |||
29 | private: |
|
29 | private: | |
30 | class QtQuick2ApplicationViewerPrivate *d; |
|
30 | class QtQuick2ApplicationViewerPrivate *d; | |
31 | }; |
|
31 | }; | |
32 |
|
32 | |||
33 | #endif // QTQUICK2APPLICATIONVIEWER_H |
|
33 | #endif // QTQUICK2APPLICATIONVIEWER_H |
General Comments 0
You need to be logged in to leave comments.
Login now