##// END OF EJS Templates
Qt5: declarative fix part3...
Marek Rosa -
r2054:96f04f377ffa
parent child
Show More
@@ -1,49 +1,49
1 !include(config.pri) {
1 !include(config.pri) {
2 error('Missing config.pri')
2 error('Missing config.pri')
3 }
3 }
4
4
5 TEMPLATE = subdirs
5 TEMPLATE = subdirs
6 SUBDIRS = src plugins demos
6 SUBDIRS = src plugins demos examples
7 #examples tests
7 # tests
8
8
9 development_build: message('Development build')
9 development_build: message('Development build')
10
10
11 CONFIG += ordered
11 CONFIG += ordered
12 QMAKE_CXXFLAGS += -g -Wall
12 QMAKE_CXXFLAGS += -g -Wall
13 unix:QMAKE_DISTCLEAN += -r build bin include lib doc/html
13 unix:QMAKE_DISTCLEAN += -r build bin include lib doc/html
14 win32:QMAKE_DISTCLEAN += /Q /s build bin include lib doc\\html
14 win32:QMAKE_DISTCLEAN += /Q /s build bin include lib doc\\html
15
15
16 # install feature file
16 # install feature file
17 feature.path = $$[QT_INSTALL_DATA]/mkspecs/features
17 feature.path = $$[QT_INSTALL_DATA]/mkspecs/features
18 feature.files = $$PWD/features/qtcommercialchart.prf
18 feature.files = $$PWD/features/qtcommercialchart.prf
19 INSTALLS += feature
19 INSTALLS += feature
20
20
21 docs.target = docs
21 docs.target = docs
22 win32:{
22 win32:{
23 docs.commands = qdoc3 $$CHART_BUILD_DOC_DIR\\qcharts.qdocconf
23 docs.commands = qdoc3 $$CHART_BUILD_DOC_DIR\\qcharts.qdocconf
24 }else{
24 }else{
25 docs.commands = qdoc3 $$CHART_BUILD_DOC_DIR/qcharts.qdocconf
25 docs.commands = qdoc3 $$CHART_BUILD_DOC_DIR/qcharts.qdocconf
26 }
26 }
27 docs.depends = FORCE
27 docs.depends = FORCE
28 QMAKE_EXTRA_TARGETS += docs
28 QMAKE_EXTRA_TARGETS += docs
29
29
30 unix:coverage:{
30 unix:coverage:{
31 QMAKE_DISTCLEAN += -r ./coverage
31 QMAKE_DISTCLEAN += -r ./coverage
32 QMAKE_CLEAN += build/*.gcda build/*.gcno
32 QMAKE_CLEAN += build/*.gcda build/*.gcno
33 QMAKE_EXTRA_TARGETS += buildcoverage runcoverage gencoverage
33 QMAKE_EXTRA_TARGETS += buildcoverage runcoverage gencoverage
34
34
35 buildcoverage.target = build_coverage
35 buildcoverage.target = build_coverage
36 buildcoverage.depends = all
36 buildcoverage.depends = all
37 buildcoverage.commands = mkdir -p ./coverage; \
37 buildcoverage.commands = mkdir -p ./coverage; \
38 make -C src prepare_coverage;
38 make -C src prepare_coverage;
39
39
40 runcoverage.target = run_coverage
40 runcoverage.target = run_coverage
41 runcoverage.depends = buildcoverage
41 runcoverage.depends = buildcoverage
42 runcoverage.commands = for f in `ls ./bin/tst_*` ; do echo "processing \$\$f test..."; \$\$f >> unit.log; done ; exit 0;
42 runcoverage.commands = for f in `ls ./bin/tst_*` ; do echo "processing \$\$f test..."; \$\$f >> unit.log; done ; exit 0;
43
43
44 gencoverage.target = gen_coverage
44 gencoverage.target = gen_coverage
45 gencoverage.depends = runcoverage
45 gencoverage.depends = runcoverage
46 gencoverage.commands = make -C src gen_coverage; \
46 gencoverage.commands = make -C src gen_coverage; \
47 genhtml -o ./coverage ./coverage/coverage.info --prefix $$PWD
47 genhtml -o ./coverage ./coverage/coverage.info --prefix $$PWD
48 }
48 }
49
49
@@ -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 <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[])
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/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();
34
38
35 return app->exec();
39 return app->exec();
36 }
40 }
@@ -1,200 +1,207
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 #ifdef QT5_QUICK_1
16 #include <QtQuick1/QDeclarativeComponent>
17 #include <QtQuick1/QDeclarativeEngine>
18 #include <QtQuick1/QDeclarativeContext>
19 #else
15 #include <QtDeclarative/QDeclarativeComponent>
20 #include <QtDeclarative/QDeclarativeComponent>
16 #include <QtDeclarative/QDeclarativeEngine>
21 #include <QtDeclarative/QDeclarativeEngine>
17 #include <QtDeclarative/QDeclarativeContext>
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
21
28
22 #ifdef HARMATTAN_BOOSTER
29 #ifdef HARMATTAN_BOOSTER
23 #include <MDeclarativeCache>
30 #include <MDeclarativeCache>
24 #endif
31 #endif
25
32
26 #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
33 #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
27
34
28 #include <qt_private/qdeclarativedebughelper_p.h>
35 #include <qt_private/qdeclarativedebughelper_p.h>
29
36
30 #if !defined(NO_JSDEBUGGER)
37 #if !defined(NO_JSDEBUGGER)
31 #include <jsdebuggeragent.h>
38 #include <jsdebuggeragent.h>
32 #endif
39 #endif
33 #if !defined(NO_QMLOBSERVER)
40 #if !defined(NO_QMLOBSERVER)
34 #include <qdeclarativeviewobserver.h>
41 #include <qdeclarativeviewobserver.h>
35 #endif
42 #endif
36
43
37 // Enable debugging before any QDeclarativeEngine is created
44 // Enable debugging before any QDeclarativeEngine is created
38 struct QmlJsDebuggingEnabler
45 struct QmlJsDebuggingEnabler
39 {
46 {
40 QmlJsDebuggingEnabler()
47 QmlJsDebuggingEnabler()
41 {
48 {
42 QDeclarativeDebugHelper::enableDebugging();
49 QDeclarativeDebugHelper::enableDebugging();
43 }
50 }
44 };
51 };
45
52
46 // Execute code in constructor before first QDeclarativeEngine is instantiated
53 // Execute code in constructor before first QDeclarativeEngine is instantiated
47 static QmlJsDebuggingEnabler enableDebuggingHelper;
54 static QmlJsDebuggingEnabler enableDebuggingHelper;
48
55
49 #endif // QMLJSDEBUGGER
56 #endif // QMLJSDEBUGGER
50
57
51 class QmlApplicationViewerPrivate
58 class QmlApplicationViewerPrivate
52 {
59 {
53 QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {}
60 QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {}
54
61
55 QString mainQmlFile;
62 QString mainQmlFile;
56 QDeclarativeView *view;
63 QDeclarativeView *view;
57 friend class QmlApplicationViewer;
64 friend class QmlApplicationViewer;
58 QString adjustPath(const QString &path);
65 QString adjustPath(const QString &path);
59 };
66 };
60
67
61 QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
68 QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
62 {
69 {
63 #ifdef Q_OS_UNIX
70 #ifdef Q_OS_UNIX
64 #ifdef Q_OS_MAC
71 #ifdef Q_OS_MAC
65 if (!QDir::isAbsolutePath(path))
72 if (!QDir::isAbsolutePath(path))
66 return QCoreApplication::applicationDirPath()
73 return QCoreApplication::applicationDirPath()
67 + QLatin1String("/../Resources/") + path;
74 + QLatin1String("/../Resources/") + path;
68 #else
75 #else
69 QString pathInInstallDir;
76 QString pathInInstallDir;
70 const QString applicationDirPath = QCoreApplication::applicationDirPath();
77 const QString applicationDirPath = QCoreApplication::applicationDirPath();
71 pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path);
78 pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path);
72
79
73 if (QFileInfo(pathInInstallDir).exists())
80 if (QFileInfo(pathInInstallDir).exists())
74 return pathInInstallDir;
81 return pathInInstallDir;
75 #endif
82 #endif
76 #endif
83 #endif
77 return path;
84 return path;
78 }
85 }
79
86
80 QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
87 QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
81 : QDeclarativeView(parent)
88 : QDeclarativeView(parent)
82 , d(new QmlApplicationViewerPrivate(this))
89 , d(new QmlApplicationViewerPrivate(this))
83 {
90 {
84 connect(engine(), SIGNAL(quit()), SLOT(close()));
91 connect(engine(), SIGNAL(quit()), SLOT(close()));
85 setResizeMode(QDeclarativeView::SizeRootObjectToView);
92 setResizeMode(QDeclarativeView::SizeRootObjectToView);
86 // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
93 // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
87 #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
94 #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
88 #if !defined(NO_JSDEBUGGER)
95 #if !defined(NO_JSDEBUGGER)
89 new QmlJSDebugger::JSDebuggerAgent(d->view->engine());
96 new QmlJSDebugger::JSDebuggerAgent(d->view->engine());
90 #endif
97 #endif
91 #if !defined(NO_QMLOBSERVER)
98 #if !defined(NO_QMLOBSERVER)
92 new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
99 new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
93 #endif
100 #endif
94 #endif
101 #endif
95 }
102 }
96
103
97 QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent)
104 QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent)
98 : QDeclarativeView(parent)
105 : QDeclarativeView(parent)
99 , d(new QmlApplicationViewerPrivate(view))
106 , d(new QmlApplicationViewerPrivate(view))
100 {
107 {
101 connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));
108 connect(view->engine(), SIGNAL(quit()), view, SLOT(close()));
102 view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
109 view->setResizeMode(QDeclarativeView::SizeRootObjectToView);
103 // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
110 // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in
104 #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
111 #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800
105 #if !defined(NO_JSDEBUGGER)
112 #if !defined(NO_JSDEBUGGER)
106 new QmlJSDebugger::JSDebuggerAgent(d->view->engine());
113 new QmlJSDebugger::JSDebuggerAgent(d->view->engine());
107 #endif
114 #endif
108 #if !defined(NO_QMLOBSERVER)
115 #if !defined(NO_QMLOBSERVER)
109 new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
116 new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view);
110 #endif
117 #endif
111 #endif
118 #endif
112 }
119 }
113
120
114 QmlApplicationViewer::~QmlApplicationViewer()
121 QmlApplicationViewer::~QmlApplicationViewer()
115 {
122 {
116 delete d;
123 delete d;
117 }
124 }
118
125
119 QmlApplicationViewer *QmlApplicationViewer::create()
126 QmlApplicationViewer *QmlApplicationViewer::create()
120 {
127 {
121 #ifdef HARMATTAN_BOOSTER
128 #ifdef HARMATTAN_BOOSTER
122 return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0);
129 return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0);
123 #else
130 #else
124 return new QmlApplicationViewer();
131 return new QmlApplicationViewer();
125 #endif
132 #endif
126 }
133 }
127
134
128 void QmlApplicationViewer::setMainQmlFile(const QString &file)
135 void QmlApplicationViewer::setMainQmlFile(const QString &file)
129 {
136 {
130 d->mainQmlFile = d->adjustPath(file);
137 d->mainQmlFile = d->adjustPath(file);
131 d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile));
138 d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile));
132 }
139 }
133
140
134 void QmlApplicationViewer::addImportPath(const QString &path)
141 void QmlApplicationViewer::addImportPath(const QString &path)
135 {
142 {
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 {
184 #if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
191 #if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR)
185 d->view->showFullScreen();
192 d->view->showFullScreen();
186 #elif defined(Q_WS_MAEMO_5)
193 #elif defined(Q_WS_MAEMO_5)
187 d->view->showMaximized();
194 d->view->showMaximized();
188 #else
195 #else
189 d->view->show();
196 d->view->show();
190 #endif
197 #endif
191 }
198 }
192
199
193 QApplication *createApplication(int &argc, char **argv)
200 QApplication *createApplication(int &argc, char **argv)
194 {
201 {
195 #ifdef HARMATTAN_BOOSTER
202 #ifdef HARMATTAN_BOOSTER
196 return MDeclarativeCache::qApplication(argc, argv);
203 return MDeclarativeCache::qApplication(argc, argv);
197 #else
204 #else
198 return new QApplication(argc, argv);
205 return new QApplication(argc, argv);
199 #endif
206 #endif
200 }
207 }
@@ -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 #ifdef QT5_QUICK_1
15 #include <QtQuick1/QDeclarativeView>
16 #else
14 #include <QtDeclarative/QDeclarativeView>
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,46 +1,48
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 #ifndef CHART_H
21 #ifndef CHART_H
22 #define CHART_H
22 #define CHART_H
23
23
24 #include <QChart>
24 #include <QChart>
25
25
26 class QGestureEvent;
27
26 QTCOMMERCIALCHART_USE_NAMESPACE
28 QTCOMMERCIALCHART_USE_NAMESPACE
27
29
28 //![1]
30 //![1]
29 class Chart : public QChart
31 class Chart : public QChart
30 //![1]
32 //![1]
31 {
33 {
32 public:
34 public:
33 explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
35 explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
34 ~Chart();
36 ~Chart();
35
37
36 protected:
38 protected:
37 bool sceneEvent(QEvent *event);
39 bool sceneEvent(QEvent *event);
38
40
39 private:
41 private:
40 bool gestureEvent(QGestureEvent* event);
42 bool gestureEvent(QGestureEvent* event);
41
43
42 private:
44 private:
43
45
44 };
46 };
45
47
46 #endif // CHART_H
48 #endif // CHART_H
@@ -1,46 +1,48
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 #ifndef CHART_H
21 #ifndef CHART_H
22 #define CHART_H
22 #define CHART_H
23
23
24 #include <QChart>
24 #include <QChart>
25
25
26 class QGestureEvent;
27
26 QTCOMMERCIALCHART_USE_NAMESPACE
28 QTCOMMERCIALCHART_USE_NAMESPACE
27
29
28 //![1]
30 //![1]
29 class Chart : public QChart
31 class Chart : public QChart
30 //![1]
32 //![1]
31 {
33 {
32 public:
34 public:
33 explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
35 explicit Chart(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
34 ~Chart();
36 ~Chart();
35
37
36 protected:
38 protected:
37 bool sceneEvent(QEvent *event);
39 bool sceneEvent(QEvent *event);
38
40
39 private:
41 private:
40 bool gestureEvent(QGestureEvent* event);
42 bool gestureEvent(QGestureEvent* event);
41
43
42 private:
44 private:
43
45
44 };
46 };
45
47
46 #endif // CHART_H
48 #endif // CHART_H
General Comments 0
You need to be logged in to leave comments. Login now