@@ -1,36 +1,40 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include <Q |
|
21 | #include <QApplication> | |
22 | #include <QDeclarativeEngine> |
|
22 | #ifdef QT5_QUICK_1 | |
|
23 | #include <QtQuick1/QDeclarativeEngine> | |||
|
24 | #else | |||
|
25 | #include <QtDeclarative/QDeclarativeEngine> | |||
|
26 | #endif | |||
23 | #include "qmlapplicationviewer.h" |
|
27 | #include "qmlapplicationviewer.h" | |
24 |
|
28 | |||
25 | Q_DECL_EXPORT int main(int argc, char *argv[]) |
|
29 | Q_DECL_EXPORT int main(int argc, char *argv[]) | |
26 | { |
|
30 | { | |
27 | QScopedPointer<QApplication> app(createApplication(argc, argv)); |
|
31 | QScopedPointer<QApplication> app(createApplication(argc, argv)); | |
28 | QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); |
|
32 | QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); | |
29 |
|
33 | |||
30 | viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); |
|
34 | //viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); | |
31 | viewer->setSource(QUrl("qrc:/qml/qmlcustomlegend/loader.qml")); |
|
35 | viewer->setSource(QUrl("qrc:/qml/qmlcustomlegend/loader.qml")); | |
32 | viewer->setRenderHint(QPainter::Antialiasing, true); |
|
36 | viewer->setRenderHint(QPainter::Antialiasing, true); | |
33 | viewer->showExpanded(); |
|
37 | viewer->showExpanded(); | |
34 |
|
38 | |||
35 | return app->exec(); |
|
39 | return app->exec(); | |
36 | } |
|
40 | } |
@@ -1,200 +1,206 | |||||
1 | // checksum 0x78c version 0x60010 |
|
1 | // checksum 0x78c version 0x60010 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
3 | This file was generated by the Qt Quick Application wizard of Qt Creator. | |
4 | QmlApplicationViewer is a convenience class containing mobile device specific |
|
4 | QmlApplicationViewer 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 "qmlapplicationviewer.h" |
|
11 | #include "qmlapplicationviewer.h" | |
12 |
|
12 | |||
13 | #include <QtCore/QDir> |
|
13 | #include <QtCore/QDir> | |
14 | #include <QtCore/QFileInfo> |
|
14 | #include <QtCore/QFileInfo> | |
15 | #include <QtDeclarative/QDeclarativeComponent> |
|
15 | #ifdef QT5_QUICK_1 | |
16 |
#include <Qt |
|
16 | #include <QtQuick1/QDeclarativeComponent> | |
17 |
#include <Qt |
|
17 | #include <QtQuick1/QDeclarativeEngine> | |
18 |
#include <Qt |
|
18 | #include <QtQuick1/QDeclarativeContext> | |
|
19 | #else | |||
|
20 | #include <QtDeclarative/QDeclarativeComponent> | |||
|
21 | #include <QtDeclarative/QDeclarativeEngine> | |||
|
22 | #include <QtDeclarative/QDeclarativeContext> | |||
|
23 | #endif | |||
|
24 | #include <QApplication> | |||
19 |
|
25 | |||
20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
26 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN | |
21 |
|
27 | |||
22 | #ifdef HARMATTAN_BOOSTER |
|
28 | #ifdef HARMATTAN_BOOSTER | |
23 | #include <MDeclarativeCache> |
|
29 | #include <MDeclarativeCache> | |
24 | #endif |
|
30 | #endif | |
25 |
|
31 | |||
26 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
32 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
27 |
|
33 | |||
28 | #include <qt_private/qdeclarativedebughelper_p.h> |
|
34 | #include <qt_private/qdeclarativedebughelper_p.h> | |
29 |
|
35 | |||
30 | #if !defined(NO_JSDEBUGGER) |
|
36 | #if !defined(NO_JSDEBUGGER) | |
31 | #include <jsdebuggeragent.h> |
|
37 | #include <jsdebuggeragent.h> | |
32 | #endif |
|
38 | #endif | |
33 | #if !defined(NO_QMLOBSERVER) |
|
39 | #if !defined(NO_QMLOBSERVER) | |
34 | #include <qdeclarativeviewobserver.h> |
|
40 | #include <qdeclarativeviewobserver.h> | |
35 | #endif |
|
41 | #endif | |
36 |
|
42 | |||
37 | // Enable debugging before any QDeclarativeEngine is created |
|
43 | // Enable debugging before any QDeclarativeEngine is created | |
38 | struct QmlJsDebuggingEnabler |
|
44 | struct QmlJsDebuggingEnabler | |
39 | { |
|
45 | { | |
40 | QmlJsDebuggingEnabler() |
|
46 | QmlJsDebuggingEnabler() | |
41 | { |
|
47 | { | |
42 | QDeclarativeDebugHelper::enableDebugging(); |
|
48 | QDeclarativeDebugHelper::enableDebugging(); | |
43 | } |
|
49 | } | |
44 | }; |
|
50 | }; | |
45 |
|
51 | |||
46 | // Execute code in constructor before first QDeclarativeEngine is instantiated |
|
52 | // Execute code in constructor before first QDeclarativeEngine is instantiated | |
47 | static QmlJsDebuggingEnabler enableDebuggingHelper; |
|
53 | static QmlJsDebuggingEnabler enableDebuggingHelper; | |
48 |
|
54 | |||
49 | #endif // QMLJSDEBUGGER |
|
55 | #endif // QMLJSDEBUGGER | |
50 |
|
56 | |||
51 | class QmlApplicationViewerPrivate |
|
57 | class QmlApplicationViewerPrivate | |
52 | { |
|
58 | { | |
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} |
|
59 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |
54 |
|
60 | |||
55 | QString mainQmlFile; |
|
61 | QString mainQmlFile; | |
56 | QDeclarativeView *view; |
|
62 | QDeclarativeView *view; | |
57 | friend class QmlApplicationViewer; |
|
63 | friend class QmlApplicationViewer; | |
58 | QString adjustPath(const QString &path); |
|
64 | QString adjustPath(const QString &path); | |
59 | }; |
|
65 | }; | |
60 |
|
66 | |||
61 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) |
|
67 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) | |
62 | { |
|
68 | { | |
63 | #ifdef Q_OS_UNIX |
|
69 | #ifdef Q_OS_UNIX | |
64 | #ifdef Q_OS_MAC |
|
70 | #ifdef Q_OS_MAC | |
65 | if (!QDir::isAbsolutePath(path)) |
|
71 | if (!QDir::isAbsolutePath(path)) | |
66 | return QCoreApplication::applicationDirPath() |
|
72 | return QCoreApplication::applicationDirPath() | |
67 | + QLatin1String("/../Resources/") + path; |
|
73 | + QLatin1String("/../Resources/") + path; | |
68 | #else |
|
74 | #else | |
69 | QString pathInInstallDir; |
|
75 | QString pathInInstallDir; | |
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); |
|
76 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); |
|
77 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |
72 |
|
78 | |||
73 | if (QFileInfo(pathInInstallDir).exists()) |
|
79 | if (QFileInfo(pathInInstallDir).exists()) | |
74 | return pathInInstallDir; |
|
80 | return pathInInstallDir; | |
75 | #endif |
|
81 | #endif | |
76 | #endif |
|
82 | #endif | |
77 | return path; |
|
83 | return path; | |
78 | } |
|
84 | } | |
79 |
|
85 | |||
80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) |
|
86 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) | |
81 | : QDeclarativeView(parent) |
|
87 | : QDeclarativeView(parent) | |
82 | , d(new QmlApplicationViewerPrivate(this)) |
|
88 | , d(new QmlApplicationViewerPrivate(this)) | |
83 | { |
|
89 | { | |
84 | connect(engine(), SIGNAL(quit()), SLOT(close())); |
|
90 | connect(engine(), SIGNAL(quit()), SLOT(close())); | |
85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
91 | setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
92 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
93 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
88 | #if !defined(NO_JSDEBUGGER) |
|
94 | #if !defined(NO_JSDEBUGGER) | |
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); |
|
95 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
90 | #endif |
|
96 | #endif | |
91 | #if !defined(NO_QMLOBSERVER) |
|
97 | #if !defined(NO_QMLOBSERVER) | |
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); |
|
98 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
93 | #endif |
|
99 | #endif | |
94 | #endif |
|
100 | #endif | |
95 | } |
|
101 | } | |
96 |
|
102 | |||
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) |
|
103 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |
98 | : QDeclarativeView(parent) |
|
104 | : QDeclarativeView(parent) | |
99 | , d(new QmlApplicationViewerPrivate(view)) |
|
105 | , d(new QmlApplicationViewerPrivate(view)) | |
100 | { |
|
106 | { | |
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); |
|
107 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); |
|
108 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
103 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in |
|
109 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
104 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 |
|
110 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
105 | #if !defined(NO_JSDEBUGGER) |
|
111 | #if !defined(NO_JSDEBUGGER) | |
106 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); |
|
112 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |
107 | #endif |
|
113 | #endif | |
108 | #if !defined(NO_QMLOBSERVER) |
|
114 | #if !defined(NO_QMLOBSERVER) | |
109 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); |
|
115 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |
110 | #endif |
|
116 | #endif | |
111 | #endif |
|
117 | #endif | |
112 | } |
|
118 | } | |
113 |
|
119 | |||
114 | QmlApplicationViewer::~QmlApplicationViewer() |
|
120 | QmlApplicationViewer::~QmlApplicationViewer() | |
115 | { |
|
121 | { | |
116 | delete d; |
|
122 | delete d; | |
117 | } |
|
123 | } | |
118 |
|
124 | |||
119 | QmlApplicationViewer *QmlApplicationViewer::create() |
|
125 | QmlApplicationViewer *QmlApplicationViewer::create() | |
120 | { |
|
126 | { | |
121 | #ifdef HARMATTAN_BOOSTER |
|
127 | #ifdef HARMATTAN_BOOSTER | |
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); |
|
128 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |
123 | #else |
|
129 | #else | |
124 | return new QmlApplicationViewer(); |
|
130 | return new QmlApplicationViewer(); | |
125 | #endif |
|
131 | #endif | |
126 | } |
|
132 | } | |
127 |
|
133 | |||
128 | void QmlApplicationViewer::setMainQmlFile(const QString &file) |
|
134 | void QmlApplicationViewer::setMainQmlFile(const QString &file) | |
129 | { |
|
135 | { | |
130 | d->mainQmlFile = d->adjustPath(file); |
|
136 | d->mainQmlFile = d->adjustPath(file); | |
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); |
|
137 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
132 | } |
|
138 | } | |
133 |
|
139 | |||
134 | void QmlApplicationViewer::addImportPath(const QString &path) |
|
140 | void QmlApplicationViewer::addImportPath(const QString &path) | |
135 | { |
|
141 | { | |
136 | d->view->engine()->addImportPath(d->adjustPath(path)); |
|
142 | d->view->engine()->addImportPath(d->adjustPath(path)); | |
137 | } |
|
143 | } | |
138 |
|
144 | |||
139 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) |
|
145 | //void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
140 | { |
|
146 | //{ | |
141 | #if defined(Q_OS_SYMBIAN) |
|
147 | //#if defined(Q_OS_SYMBIAN) | |
142 | // If the version of Qt on the device is < 4.7.2, that attribute won't work |
|
148 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
143 | if (orientation != ScreenOrientationAuto) { |
|
149 | // if (orientation != ScreenOrientationAuto) { | |
144 | const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); |
|
150 | // const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); | |
145 | if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { |
|
151 | // if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
146 | qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); |
|
152 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
147 | return; |
|
153 | // return; | |
148 | } |
|
154 | // } | |
149 | } |
|
155 | // } | |
150 | #endif // Q_OS_SYMBIAN |
|
156 | //#endif // Q_OS_SYMBIAN | |
151 |
|
157 | |||
152 | Qt::WidgetAttribute attribute; |
|
158 | // Qt::WidgetAttribute attribute; | |
153 | switch (orientation) { |
|
159 | // switch (orientation) { | |
154 | #if QT_VERSION < 0x040702 |
|
160 | //#if QT_VERSION < 0x040702 | |
155 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes |
|
161 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
156 | case ScreenOrientationLockPortrait: |
|
162 | // case ScreenOrientationLockPortrait: | |
157 | attribute = static_cast<Qt::WidgetAttribute>(128); |
|
163 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
158 | break; |
|
164 | // break; | |
159 | case ScreenOrientationLockLandscape: |
|
165 | // case ScreenOrientationLockLandscape: | |
160 | attribute = static_cast<Qt::WidgetAttribute>(129); |
|
166 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
161 | break; |
|
167 | // break; | |
162 | default: |
|
168 | // default: | |
163 | case ScreenOrientationAuto: |
|
169 | // case ScreenOrientationAuto: | |
164 | attribute = static_cast<Qt::WidgetAttribute>(130); |
|
170 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
165 | break; |
|
171 | // break; | |
166 | #else // QT_VERSION < 0x040702 |
|
172 | //#else // QT_VERSION < 0x040702 | |
167 | case ScreenOrientationLockPortrait: |
|
173 | // case ScreenOrientationLockPortrait: | |
168 | attribute = Qt::WA_LockPortraitOrientation; |
|
174 | // attribute = Qt::WA_LockPortraitOrientation; | |
169 | break; |
|
175 | // break; | |
170 | case ScreenOrientationLockLandscape: |
|
176 | // case ScreenOrientationLockLandscape: | |
171 | attribute = Qt::WA_LockLandscapeOrientation; |
|
177 | // attribute = Qt::WA_LockLandscapeOrientation; | |
172 | break; |
|
178 | // break; | |
173 | default: |
|
179 | // default: | |
174 | case ScreenOrientationAuto: |
|
180 | // case ScreenOrientationAuto: | |
175 | attribute = Qt::WA_AutoOrientation; |
|
181 | // attribute = Qt::WA_AutoOrientation; | |
176 | break; |
|
182 | // break; | |
177 | #endif // QT_VERSION < 0x040702 |
|
183 | //#endif // QT_VERSION < 0x040702 | |
178 | }; |
|
184 | // }; | |
179 | setAttribute(attribute, true); |
|
185 | // setAttribute(attribute, true); | |
180 | } |
|
186 | //} | |
181 |
|
187 | |||
182 | void QmlApplicationViewer::showExpanded() |
|
188 | void QmlApplicationViewer::showExpanded() | |
183 | { |
|
189 | { | |
184 | #if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) |
|
190 | #if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
185 | d->view->showFullScreen(); |
|
191 | d->view->showFullScreen(); | |
186 | #elif defined(Q_WS_MAEMO_5) |
|
192 | #elif defined(Q_WS_MAEMO_5) | |
187 | d->view->showMaximized(); |
|
193 | d->view->showMaximized(); | |
188 | #else |
|
194 | #else | |
189 | d->view->show(); |
|
195 | d->view->show(); | |
190 | #endif |
|
196 | #endif | |
191 | } |
|
197 | } | |
192 |
|
198 | |||
193 | QApplication *createApplication(int &argc, char **argv) |
|
199 | QApplication *createApplication(int &argc, char **argv) | |
194 | { |
|
200 | { | |
195 | #ifdef HARMATTAN_BOOSTER |
|
201 | #ifdef HARMATTAN_BOOSTER | |
196 | return MDeclarativeCache::qApplication(argc, argv); |
|
202 | return MDeclarativeCache::qApplication(argc, argv); | |
197 | #else |
|
203 | #else | |
198 | return new QApplication(argc, argv); |
|
204 | return new QApplication(argc, argv); | |
199 | #endif |
|
205 | #endif | |
200 | } |
|
206 | } |
@@ -1,47 +1,51 | |||||
1 | // checksum 0x82ed version 0x60010 |
|
1 | // checksum 0x82ed version 0x60010 | |
2 | /* |
|
2 | /* | |
3 | This file was generated by the Qt Quick Application wizard of Qt Creator. |
|
3 | This file was generated by the Qt Quick Application wizard of Qt Creator. | |
4 | QmlApplicationViewer is a convenience class containing mobile device specific |
|
4 | QmlApplicationViewer 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 QMLAPPLICATIONVIEWER_H |
|
11 | #ifndef QMLAPPLICATIONVIEWER_H | |
12 | #define QMLAPPLICATIONVIEWER_H |
|
12 | #define QMLAPPLICATIONVIEWER_H | |
13 |
|
13 | |||
14 | #include <QtDeclarative/QDeclarativeView> |
|
14 | #ifdef QT5_QUICK_1 | |
|
15 | #include <QtQuick1/QDeclarativeView> | |||
|
16 | #else | |||
|
17 | #include <QtDeclarative/QDeclarativeView> | |||
|
18 | #endif | |||
15 |
|
19 | |||
16 | class QmlApplicationViewer : public QDeclarativeView |
|
20 | class QmlApplicationViewer : public QDeclarativeView | |
17 | { |
|
21 | { | |
18 | Q_OBJECT |
|
22 | Q_OBJECT | |
19 |
|
23 | |||
20 | public: |
|
24 | public: | |
21 | enum ScreenOrientation { |
|
25 | enum ScreenOrientation { | |
22 | ScreenOrientationLockPortrait, |
|
26 | ScreenOrientationLockPortrait, | |
23 | ScreenOrientationLockLandscape, |
|
27 | ScreenOrientationLockLandscape, | |
24 | ScreenOrientationAuto |
|
28 | ScreenOrientationAuto | |
25 | }; |
|
29 | }; | |
26 |
|
30 | |||
27 | explicit QmlApplicationViewer(QWidget *parent = 0); |
|
31 | explicit QmlApplicationViewer(QWidget *parent = 0); | |
28 | virtual ~QmlApplicationViewer(); |
|
32 | virtual ~QmlApplicationViewer(); | |
29 |
|
33 | |||
30 | static QmlApplicationViewer *create(); |
|
34 | static QmlApplicationViewer *create(); | |
31 |
|
35 | |||
32 | void setMainQmlFile(const QString &file); |
|
36 | void setMainQmlFile(const QString &file); | |
33 | void addImportPath(const QString &path); |
|
37 | void addImportPath(const QString &path); | |
34 |
|
38 | |||
35 | // Note that this will only have an effect on Symbian and Fremantle. |
|
39 | // Note that this will only have an effect on Symbian and Fremantle. | |
36 | void setOrientation(ScreenOrientation orientation); |
|
40 | // void setOrientation(ScreenOrientation orientation); | |
37 |
|
41 | |||
38 | void showExpanded(); |
|
42 | void showExpanded(); | |
39 |
|
43 | |||
40 | private: |
|
44 | private: | |
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); |
|
45 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |
42 | class QmlApplicationViewerPrivate *d; |
|
46 | class QmlApplicationViewerPrivate *d; | |
43 | }; |
|
47 | }; | |
44 |
|
48 | |||
45 | QApplication *createApplication(int &argc, char **argv); |
|
49 | QApplication *createApplication(int &argc, char **argv); | |
46 |
|
50 | |||
47 | #endif // QMLAPPLICATIONVIEWER_H |
|
51 | #endif // QMLAPPLICATIONVIEWER_H |
@@ -1,13 +1,17 | |||||
1 | QT += declarative |
|
1 | greaterThan(QT_MAJOR_VERSION, 4) { | |
|
2 | QT += quick1 | |||
|
3 | } else { | |||
|
4 | QT += declarative | |||
|
5 | } | |||
2 |
|
6 | |||
3 | SOURCES += $$PWD/qmlapplicationviewer.cpp |
|
7 | SOURCES += $$PWD/qmlapplicationviewer.cpp | |
4 | HEADERS += $$PWD/qmlapplicationviewer.h |
|
8 | HEADERS += $$PWD/qmlapplicationviewer.h | |
5 | INCLUDEPATH += $$PWD |
|
9 | INCLUDEPATH += $$PWD | |
6 |
|
10 | |||
7 | # Include JS debugger library if QMLJSDEBUGGER_PATH is set |
|
11 | # Include JS debugger library if QMLJSDEBUGGER_PATH is set | |
8 | !isEmpty(QMLJSDEBUGGER_PATH) { |
|
12 | !isEmpty(QMLJSDEBUGGER_PATH) { | |
9 | include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) |
|
13 | include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) | |
10 | } else { |
|
14 | } else { | |
11 | DEFINES -= QMLJSDEBUGGER |
|
15 | DEFINES -= QMLJSDEBUGGER | |
12 | } |
|
16 | } | |
13 |
|
17 |
General Comments 0
You need to be logged in to leave comments.
Login now