@@ -3,8 +3,8 | |||||
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | TEMPLATE = subdirs |
|
5 | TEMPLATE = subdirs | |
6 | SUBDIRS = src plugins demos |
|
6 | SUBDIRS = src plugins demos examples | |
7 |
# |
|
7 | # tests | |
8 |
|
8 | |||
9 | development_build: message('Development build') |
|
9 | development_build: message('Development build') | |
10 |
|
10 |
@@ -19,7 +19,11 | |||||
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QApplication> |
|
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[]) | |
@@ -27,7 +31,7 Q_DECL_EXPORT int main(int argc, char *argv[]) | |||||
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/qmlpiechart/main.qml")); |
|
35 | viewer->setSource(QUrl("qrc:/qml/qmlpiechart/main.qml")); | |
32 | viewer->setRenderHint(QPainter::Antialiasing, true); |
|
36 | viewer->setRenderHint(QPainter::Antialiasing, true); | |
33 | viewer->showExpanded(); |
|
37 | viewer->showExpanded(); |
@@ -12,9 +12,16 | |||||
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 <QtQuick1/QDeclarativeContext> | |||
|
19 | #else | |||
|
20 | #include <QtDeclarative/QDeclarativeComponent> | |||
|
21 | #include <QtDeclarative/QDeclarativeEngine> | |||
|
22 | #include <QtDeclarative/QDeclarativeContext> | |||
|
23 | #endif | |||
|
24 | ||||
18 | #include <QApplication> |
|
25 | #include <QApplication> | |
19 |
|
26 | |||
20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN |
|
27 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN | |
@@ -136,48 +143,48 void QmlApplicationViewer::addImportPath(const QString &path) | |||||
136 | d->view->engine()->addImportPath(d->adjustPath(path)); |
|
143 | d->view->engine()->addImportPath(d->adjustPath(path)); | |
137 | } |
|
144 | } | |
138 |
|
145 | |||
139 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) |
|
146 | //void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
140 | { |
|
147 | //{ | |
141 | #if defined(Q_OS_SYMBIAN) |
|
148 | //#if defined(Q_OS_SYMBIAN) | |
142 | // If the version of Qt on the device is < 4.7.2, that attribute won't work |
|
149 | // // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
143 | if (orientation != ScreenOrientationAuto) { |
|
150 | // if (orientation != ScreenOrientationAuto) { | |
144 | const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); |
|
151 | // 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) { |
|
152 | // 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"); |
|
153 | // qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
147 | return; |
|
154 | // return; | |
148 | } |
|
155 | // } | |
149 | } |
|
156 | // } | |
150 | #endif // Q_OS_SYMBIAN |
|
157 | //#endif // Q_OS_SYMBIAN | |
151 |
|
158 | |||
152 | Qt::WidgetAttribute attribute; |
|
159 | // Qt::WidgetAttribute attribute; | |
153 | switch (orientation) { |
|
160 | // switch (orientation) { | |
154 | #if QT_VERSION < 0x040702 |
|
161 | //#if QT_VERSION < 0x040702 | |
155 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes |
|
162 | // // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
156 | case ScreenOrientationLockPortrait: |
|
163 | // case ScreenOrientationLockPortrait: | |
157 | attribute = static_cast<Qt::WidgetAttribute>(128); |
|
164 | // attribute = static_cast<Qt::WidgetAttribute>(128); | |
158 | break; |
|
165 | // break; | |
159 | case ScreenOrientationLockLandscape: |
|
166 | // case ScreenOrientationLockLandscape: | |
160 | attribute = static_cast<Qt::WidgetAttribute>(129); |
|
167 | // attribute = static_cast<Qt::WidgetAttribute>(129); | |
161 | break; |
|
168 | // break; | |
162 | default: |
|
169 | // default: | |
163 | case ScreenOrientationAuto: |
|
170 | // case ScreenOrientationAuto: | |
164 | attribute = static_cast<Qt::WidgetAttribute>(130); |
|
171 | // attribute = static_cast<Qt::WidgetAttribute>(130); | |
165 | break; |
|
172 | // break; | |
166 | #else // QT_VERSION < 0x040702 |
|
173 | //#else // QT_VERSION < 0x040702 | |
167 | case ScreenOrientationLockPortrait: |
|
174 | // case ScreenOrientationLockPortrait: | |
168 | attribute = Qt::WA_LockPortraitOrientation; |
|
175 | // attribute = Qt::WA_LockPortraitOrientation; | |
169 | break; |
|
176 | // break; | |
170 | case ScreenOrientationLockLandscape: |
|
177 | // case ScreenOrientationLockLandscape: | |
171 | attribute = Qt::WA_LockLandscapeOrientation; |
|
178 | // attribute = Qt::WA_LockLandscapeOrientation; | |
172 | break; |
|
179 | // break; | |
173 | default: |
|
180 | // default: | |
174 | case ScreenOrientationAuto: |
|
181 | // case ScreenOrientationAuto: | |
175 | attribute = Qt::WA_AutoOrientation; |
|
182 | // attribute = Qt::WA_AutoOrientation; | |
176 | break; |
|
183 | // break; | |
177 | #endif // QT_VERSION < 0x040702 |
|
184 | //#endif // QT_VERSION < 0x040702 | |
178 | }; |
|
185 | // }; | |
179 | setAttribute(attribute, true); |
|
186 | // setAttribute(attribute, true); | |
180 | } |
|
187 | //} | |
181 |
|
188 | |||
182 | void QmlApplicationViewer::showExpanded() |
|
189 | void QmlApplicationViewer::showExpanded() | |
183 | { |
|
190 | { |
@@ -11,7 +11,11 | |||||
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 | { | |
@@ -33,7 +37,7 public: | |||||
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 |
General Comments 0
You need to be logged in to leave comments.
Login now