@@ -0,0 +1,36 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | #include <QtGui/QApplication> | |||
|
22 | #include <QDeclarativeEngine> | |||
|
23 | #include "qmlapplicationviewer.h" | |||
|
24 | ||||
|
25 | Q_DECL_EXPORT int main(int argc, char *argv[]) | |||
|
26 | { | |||
|
27 | QScopedPointer<QApplication> app(createApplication(argc, argv)); | |||
|
28 | QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); | |||
|
29 | ||||
|
30 | viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); | |||
|
31 | viewer->setSource(QUrl("qrc:/qml/qmlaxes/loader.qml")); | |||
|
32 | viewer->setRenderHint(QPainter::Antialiasing, true); | |||
|
33 | viewer->showExpanded(); | |||
|
34 | ||||
|
35 | return app->exec(); | |||
|
36 | } |
@@ -0,0 +1,67 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.1 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Two Series, Common Axes" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.visible: false | |||
|
32 | ||||
|
33 | ValueAxis { | |||
|
34 | id: axisX | |||
|
35 | min: 0 | |||
|
36 | max: 10 | |||
|
37 | tickCount: 5 | |||
|
38 | } | |||
|
39 | ||||
|
40 | ValueAxis { | |||
|
41 | id: axisY | |||
|
42 | min: -0.5 | |||
|
43 | max: 1.5 | |||
|
44 | } | |||
|
45 | ||||
|
46 | LineSeries { | |||
|
47 | id: series1 | |||
|
48 | axisX: axisX | |||
|
49 | axisY: axisY | |||
|
50 | } | |||
|
51 | ||||
|
52 | ScatterSeries { | |||
|
53 | id: series2 | |||
|
54 | axisX: axisX | |||
|
55 | axisY: axisY | |||
|
56 | } | |||
|
57 | } | |||
|
58 | ||||
|
59 | // Add data dynamically to the series | |||
|
60 | Component.onCompleted: { | |||
|
61 | for (var i = 0; i <= 10; i++) { | |||
|
62 | series1.append(i, Math.random()); | |||
|
63 | series2.append(i, Math.random()); | |||
|
64 | } | |||
|
65 | } | |||
|
66 | //![1] | |||
|
67 | } |
@@ -0,0 +1,59 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.1 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Accurate Historical Data" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.visible: false | |||
|
32 | ||||
|
33 | LineSeries { | |||
|
34 | axisX: DateTimeAxis { | |||
|
35 | format: "yyyy MMM" | |||
|
36 | tickCount: 5 | |||
|
37 | } | |||
|
38 | axisY: ValueAxis { | |||
|
39 | min: 0 | |||
|
40 | max: 150 | |||
|
41 | } | |||
|
42 | ||||
|
43 | // Please note that month in JavaScript months are zero based, so 2 means March | |||
|
44 | XYPoint { x: toMsecsSinceEpoch(new Date(1950, 2, 15)); y: 5 } | |||
|
45 | XYPoint { x: toMsecsSinceEpoch(new Date(1970, 0, 1)); y: 50 } | |||
|
46 | XYPoint { x: toMsecsSinceEpoch(new Date(1987, 12, 31)); y: 102 } | |||
|
47 | XYPoint { x: toMsecsSinceEpoch(new Date(1998, 7, 1)); y: 100 } | |||
|
48 | XYPoint { x: toMsecsSinceEpoch(new Date(2012, 8, 2)); y: 110 } | |||
|
49 | } | |||
|
50 | } | |||
|
51 | ||||
|
52 | // DateTimeAxis is based on QDateTimes so we must convert our JavaScript dates to | |||
|
53 | // milliseconds since epoch to make them match the DateTimeAxis values | |||
|
54 | function toMsecsSinceEpoch(date) { | |||
|
55 | var msecs = date.getTime(); | |||
|
56 | return msecs; | |||
|
57 | } | |||
|
58 | //![1] | |||
|
59 | } |
@@ -0,0 +1,67 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | import QtCommercial.Chart 1.1 | |||
|
23 | ||||
|
24 | Rectangle { | |||
|
25 | anchors.fill: parent | |||
|
26 | ||||
|
27 | //![1] | |||
|
28 | ChartView { | |||
|
29 | title: "Numerical Data for Dummies" | |||
|
30 | anchors.fill: parent | |||
|
31 | legend.visible: false | |||
|
32 | ||||
|
33 | LineSeries { | |||
|
34 | axisY: CategoryAxis { | |||
|
35 | min: 0 | |||
|
36 | max: 30 | |||
|
37 | CategoryRange { | |||
|
38 | label: "critical" | |||
|
39 | endValue: 2 | |||
|
40 | } | |||
|
41 | CategoryRange { | |||
|
42 | label: "low" | |||
|
43 | endValue: 4 | |||
|
44 | } | |||
|
45 | CategoryRange { | |||
|
46 | label: "normal" | |||
|
47 | endValue: 7 | |||
|
48 | } | |||
|
49 | CategoryRange { | |||
|
50 | label: "high" | |||
|
51 | endValue: 15 | |||
|
52 | } | |||
|
53 | CategoryRange { | |||
|
54 | label: "extremely high" | |||
|
55 | endValue: 30 | |||
|
56 | } | |||
|
57 | } | |||
|
58 | ||||
|
59 | XYPoint { x: 0; y: 4.3 } | |||
|
60 | XYPoint { x: 1; y: 4.1 } | |||
|
61 | XYPoint { x: 2; y: 4.7 } | |||
|
62 | XYPoint { x: 3; y: 3.9 } | |||
|
63 | XYPoint { x: 4; y: 5.2 } | |||
|
64 | } | |||
|
65 | } | |||
|
66 | //![1] | |||
|
67 | } |
@@ -0,0 +1,37 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | ||||
|
23 | Item { | |||
|
24 | id: container | |||
|
25 | width: 400 | |||
|
26 | height: 300 | |||
|
27 | Component.onCompleted: { | |||
|
28 | var co = Qt.createComponent("main.qml") | |||
|
29 | if (co.status == Component.Ready) { | |||
|
30 | var o = co.createObject(container) | |||
|
31 | } else { | |||
|
32 | console.log(co.errorString()) | |||
|
33 | console.log("QtCommercial.Chart 1.1 not available") | |||
|
34 | console.log("Please use correct QML_IMPORT_PATH export") | |||
|
35 | } | |||
|
36 | } | |||
|
37 | } |
@@ -0,0 +1,90 | |||||
|
1 | /**************************************************************************** | |||
|
2 | ** | |||
|
3 | ** Copyright (C) 2012 Digia Plc | |||
|
4 | ** All rights reserved. | |||
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |||
|
6 | ** | |||
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |||
|
8 | ** | |||
|
9 | ** $QT_BEGIN_LICENSE$ | |||
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |||
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |||
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |||
|
13 | ** a written agreement between you and Digia. | |||
|
14 | ** | |||
|
15 | ** If you have questions regarding the use of this file, please use | |||
|
16 | ** contact form at http://qt.digia.com | |||
|
17 | ** $QT_END_LICENSE$ | |||
|
18 | ** | |||
|
19 | ****************************************************************************/ | |||
|
20 | ||||
|
21 | import QtQuick 1.0 | |||
|
22 | ||||
|
23 | Rectangle { | |||
|
24 | width: parent.width | |||
|
25 | height: parent.height | |||
|
26 | property int viewNumber: 1 | |||
|
27 | property int viewCount: 3 | |||
|
28 | ||||
|
29 | Loader { | |||
|
30 | id: loader | |||
|
31 | anchors.fill: parent | |||
|
32 | source: "View" + viewNumber + ".qml"; | |||
|
33 | } | |||
|
34 | ||||
|
35 | Rectangle { | |||
|
36 | id: infoText | |||
|
37 | anchors.centerIn: parent | |||
|
38 | width: parent.width | |||
|
39 | height: 40 | |||
|
40 | color: "black" | |||
|
41 | Text { | |||
|
42 | color: "white" | |||
|
43 | anchors.centerIn: parent | |||
|
44 | text: "Use left and right arrow keys to navigate" | |||
|
45 | } | |||
|
46 | ||||
|
47 | Behavior on opacity { | |||
|
48 | NumberAnimation { duration: 400 } | |||
|
49 | } | |||
|
50 | } | |||
|
51 | ||||
|
52 | MouseArea { | |||
|
53 | focus: true | |||
|
54 | anchors.fill: parent | |||
|
55 | onClicked: { | |||
|
56 | if (infoText.opacity > 0) { | |||
|
57 | infoText.opacity = 0.0; | |||
|
58 | } else { | |||
|
59 | nextView(); | |||
|
60 | } | |||
|
61 | } | |||
|
62 | Keys.onPressed: { | |||
|
63 | if (infoText.opacity > 0) { | |||
|
64 | infoText.opacity = 0.0; | |||
|
65 | } else { | |||
|
66 | if (event.key == Qt.Key_Left) { | |||
|
67 | previousView(); | |||
|
68 | } else { | |||
|
69 | nextView(); | |||
|
70 | } | |||
|
71 | } | |||
|
72 | } | |||
|
73 | } | |||
|
74 | ||||
|
75 | function nextView() { | |||
|
76 | var i = viewNumber + 1; | |||
|
77 | if (i > viewCount) | |||
|
78 | viewNumber = 1; | |||
|
79 | else | |||
|
80 | viewNumber = i; | |||
|
81 | } | |||
|
82 | ||||
|
83 | function previousView() { | |||
|
84 | var i = viewNumber - 1; | |||
|
85 | if (i <= 0) | |||
|
86 | viewNumber = viewCount; | |||
|
87 | else | |||
|
88 | viewNumber = i; | |||
|
89 | } | |||
|
90 | } |
@@ -0,0 +1,200 | |||||
|
1 | // checksum 0x78c version 0x60010 | |||
|
2 | /* | |||
|
3 | This file was generated by the Qt Quick Application wizard of Qt Creator. | |||
|
4 | QmlApplicationViewer 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 | ||||
|
11 | #include "qmlapplicationviewer.h" | |||
|
12 | ||||
|
13 | #include <QtCore/QDir> | |||
|
14 | #include <QtCore/QFileInfo> | |||
|
15 | #include <QtDeclarative/QDeclarativeComponent> | |||
|
16 | #include <QtDeclarative/QDeclarativeEngine> | |||
|
17 | #include <QtDeclarative/QDeclarativeContext> | |||
|
18 | #include <QtGui/QApplication> | |||
|
19 | ||||
|
20 | #include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN | |||
|
21 | ||||
|
22 | #ifdef HARMATTAN_BOOSTER | |||
|
23 | #include <MDeclarativeCache> | |||
|
24 | #endif | |||
|
25 | ||||
|
26 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |||
|
27 | ||||
|
28 | #include <qt_private/qdeclarativedebughelper_p.h> | |||
|
29 | ||||
|
30 | #if !defined(NO_JSDEBUGGER) | |||
|
31 | #include <jsdebuggeragent.h> | |||
|
32 | #endif | |||
|
33 | #if !defined(NO_QMLOBSERVER) | |||
|
34 | #include <qdeclarativeviewobserver.h> | |||
|
35 | #endif | |||
|
36 | ||||
|
37 | // Enable debugging before any QDeclarativeEngine is created | |||
|
38 | struct QmlJsDebuggingEnabler | |||
|
39 | { | |||
|
40 | QmlJsDebuggingEnabler() | |||
|
41 | { | |||
|
42 | QDeclarativeDebugHelper::enableDebugging(); | |||
|
43 | } | |||
|
44 | }; | |||
|
45 | ||||
|
46 | // Execute code in constructor before first QDeclarativeEngine is instantiated | |||
|
47 | static QmlJsDebuggingEnabler enableDebuggingHelper; | |||
|
48 | ||||
|
49 | #endif // QMLJSDEBUGGER | |||
|
50 | ||||
|
51 | class QmlApplicationViewerPrivate | |||
|
52 | { | |||
|
53 | QmlApplicationViewerPrivate(QDeclarativeView *view_) : view(view_) {} | |||
|
54 | ||||
|
55 | QString mainQmlFile; | |||
|
56 | QDeclarativeView *view; | |||
|
57 | friend class QmlApplicationViewer; | |||
|
58 | QString adjustPath(const QString &path); | |||
|
59 | }; | |||
|
60 | ||||
|
61 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) | |||
|
62 | { | |||
|
63 | #ifdef Q_OS_UNIX | |||
|
64 | #ifdef Q_OS_MAC | |||
|
65 | if (!QDir::isAbsolutePath(path)) | |||
|
66 | return QCoreApplication::applicationDirPath() | |||
|
67 | + QLatin1String("/../Resources/") + path; | |||
|
68 | #else | |||
|
69 | QString pathInInstallDir; | |||
|
70 | const QString applicationDirPath = QCoreApplication::applicationDirPath(); | |||
|
71 | pathInInstallDir = QString::fromAscii("%1/../%2").arg(applicationDirPath, path); | |||
|
72 | ||||
|
73 | if (QFileInfo(pathInInstallDir).exists()) | |||
|
74 | return pathInInstallDir; | |||
|
75 | #endif | |||
|
76 | #endif | |||
|
77 | return path; | |||
|
78 | } | |||
|
79 | ||||
|
80 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) | |||
|
81 | : QDeclarativeView(parent) | |||
|
82 | , d(new QmlApplicationViewerPrivate(this)) | |||
|
83 | { | |||
|
84 | connect(engine(), SIGNAL(quit()), SLOT(close())); | |||
|
85 | setResizeMode(QDeclarativeView::SizeRootObjectToView); | |||
|
86 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |||
|
87 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |||
|
88 | #if !defined(NO_JSDEBUGGER) | |||
|
89 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |||
|
90 | #endif | |||
|
91 | #if !defined(NO_QMLOBSERVER) | |||
|
92 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |||
|
93 | #endif | |||
|
94 | #endif | |||
|
95 | } | |||
|
96 | ||||
|
97 | QmlApplicationViewer::QmlApplicationViewer(QDeclarativeView *view, QWidget *parent) | |||
|
98 | : QDeclarativeView(parent) | |||
|
99 | , d(new QmlApplicationViewerPrivate(view)) | |||
|
100 | { | |||
|
101 | connect(view->engine(), SIGNAL(quit()), view, SLOT(close())); | |||
|
102 | view->setResizeMode(QDeclarativeView::SizeRootObjectToView); | |||
|
103 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |||
|
104 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |||
|
105 | #if !defined(NO_JSDEBUGGER) | |||
|
106 | new QmlJSDebugger::JSDebuggerAgent(d->view->engine()); | |||
|
107 | #endif | |||
|
108 | #if !defined(NO_QMLOBSERVER) | |||
|
109 | new QmlJSDebugger::QDeclarativeViewObserver(d->view, d->view); | |||
|
110 | #endif | |||
|
111 | #endif | |||
|
112 | } | |||
|
113 | ||||
|
114 | QmlApplicationViewer::~QmlApplicationViewer() | |||
|
115 | { | |||
|
116 | delete d; | |||
|
117 | } | |||
|
118 | ||||
|
119 | QmlApplicationViewer *QmlApplicationViewer::create() | |||
|
120 | { | |||
|
121 | #ifdef HARMATTAN_BOOSTER | |||
|
122 | return new QmlApplicationViewer(MDeclarativeCache::qDeclarativeView(), 0); | |||
|
123 | #else | |||
|
124 | return new QmlApplicationViewer(); | |||
|
125 | #endif | |||
|
126 | } | |||
|
127 | ||||
|
128 | void QmlApplicationViewer::setMainQmlFile(const QString &file) | |||
|
129 | { | |||
|
130 | d->mainQmlFile = d->adjustPath(file); | |||
|
131 | d->view->setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |||
|
132 | } | |||
|
133 | ||||
|
134 | void QmlApplicationViewer::addImportPath(const QString &path) | |||
|
135 | { | |||
|
136 | d->view->engine()->addImportPath(d->adjustPath(path)); | |||
|
137 | } | |||
|
138 | ||||
|
139 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |||
|
140 | { | |||
|
141 | #if defined(Q_OS_SYMBIAN) | |||
|
142 | // If the version of Qt on the device is < 4.7.2, that attribute won't work | |||
|
143 | if (orientation != ScreenOrientationAuto) { | |||
|
144 | 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) { | |||
|
146 | qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |||
|
147 | return; | |||
|
148 | } | |||
|
149 | } | |||
|
150 | #endif // Q_OS_SYMBIAN | |||
|
151 | ||||
|
152 | Qt::WidgetAttribute attribute; | |||
|
153 | switch (orientation) { | |||
|
154 | #if QT_VERSION < 0x040702 | |||
|
155 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |||
|
156 | case ScreenOrientationLockPortrait: | |||
|
157 | attribute = static_cast<Qt::WidgetAttribute>(128); | |||
|
158 | break; | |||
|
159 | case ScreenOrientationLockLandscape: | |||
|
160 | attribute = static_cast<Qt::WidgetAttribute>(129); | |||
|
161 | break; | |||
|
162 | default: | |||
|
163 | case ScreenOrientationAuto: | |||
|
164 | attribute = static_cast<Qt::WidgetAttribute>(130); | |||
|
165 | break; | |||
|
166 | #else // QT_VERSION < 0x040702 | |||
|
167 | case ScreenOrientationLockPortrait: | |||
|
168 | attribute = Qt::WA_LockPortraitOrientation; | |||
|
169 | break; | |||
|
170 | case ScreenOrientationLockLandscape: | |||
|
171 | attribute = Qt::WA_LockLandscapeOrientation; | |||
|
172 | break; | |||
|
173 | default: | |||
|
174 | case ScreenOrientationAuto: | |||
|
175 | attribute = Qt::WA_AutoOrientation; | |||
|
176 | break; | |||
|
177 | #endif // QT_VERSION < 0x040702 | |||
|
178 | }; | |||
|
179 | setAttribute(attribute, true); | |||
|
180 | } | |||
|
181 | ||||
|
182 | void QmlApplicationViewer::showExpanded() | |||
|
183 | { | |||
|
184 | #if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |||
|
185 | d->view->showFullScreen(); | |||
|
186 | #elif defined(Q_WS_MAEMO_5) | |||
|
187 | d->view->showMaximized(); | |||
|
188 | #else | |||
|
189 | d->view->show(); | |||
|
190 | #endif | |||
|
191 | } | |||
|
192 | ||||
|
193 | QApplication *createApplication(int &argc, char **argv) | |||
|
194 | { | |||
|
195 | #ifdef HARMATTAN_BOOSTER | |||
|
196 | return MDeclarativeCache::qApplication(argc, argv); | |||
|
197 | #else | |||
|
198 | return new QApplication(argc, argv); | |||
|
199 | #endif | |||
|
200 | } |
@@ -0,0 +1,47 | |||||
|
1 | // checksum 0x82ed version 0x60010 | |||
|
2 | /* | |||
|
3 | This file was generated by the Qt Quick Application wizard of Qt Creator. | |||
|
4 | QmlApplicationViewer 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 | ||||
|
11 | #ifndef QMLAPPLICATIONVIEWER_H | |||
|
12 | #define QMLAPPLICATIONVIEWER_H | |||
|
13 | ||||
|
14 | #include <QtDeclarative/QDeclarativeView> | |||
|
15 | ||||
|
16 | class QmlApplicationViewer : public QDeclarativeView | |||
|
17 | { | |||
|
18 | Q_OBJECT | |||
|
19 | ||||
|
20 | public: | |||
|
21 | enum ScreenOrientation { | |||
|
22 | ScreenOrientationLockPortrait, | |||
|
23 | ScreenOrientationLockLandscape, | |||
|
24 | ScreenOrientationAuto | |||
|
25 | }; | |||
|
26 | ||||
|
27 | explicit QmlApplicationViewer(QWidget *parent = 0); | |||
|
28 | virtual ~QmlApplicationViewer(); | |||
|
29 | ||||
|
30 | static QmlApplicationViewer *create(); | |||
|
31 | ||||
|
32 | void setMainQmlFile(const QString &file); | |||
|
33 | void addImportPath(const QString &path); | |||
|
34 | ||||
|
35 | // Note that this will only have an effect on Symbian and Fremantle. | |||
|
36 | void setOrientation(ScreenOrientation orientation); | |||
|
37 | ||||
|
38 | void showExpanded(); | |||
|
39 | ||||
|
40 | private: | |||
|
41 | explicit QmlApplicationViewer(QDeclarativeView *view, QWidget *parent); | |||
|
42 | class QmlApplicationViewerPrivate *d; | |||
|
43 | }; | |||
|
44 | ||||
|
45 | QApplication *createApplication(int &argc, char **argv); | |||
|
46 | ||||
|
47 | #endif // QMLAPPLICATIONVIEWER_H |
@@ -0,0 +1,13 | |||||
|
1 | QT += declarative | |||
|
2 | ||||
|
3 | SOURCES += $$PWD/qmlapplicationviewer.cpp | |||
|
4 | HEADERS += $$PWD/qmlapplicationviewer.h | |||
|
5 | INCLUDEPATH += $$PWD | |||
|
6 | ||||
|
7 | # Include JS debugger library if QMLJSDEBUGGER_PATH is set | |||
|
8 | !isEmpty(QMLJSDEBUGGER_PATH) { | |||
|
9 | include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) | |||
|
10 | } else { | |||
|
11 | DEFINES -= QMLJSDEBUGGER | |||
|
12 | } | |||
|
13 |
@@ -0,0 +1,8 | |||||
|
1 | !include( ../demos.pri ) { | |||
|
2 | error( "Couldn't find the demos.pri file!" ) | |||
|
3 | } | |||
|
4 | ||||
|
5 | RESOURCES += resources.qrc | |||
|
6 | SOURCES += main.cpp | |||
|
7 | ||||
|
8 | include(qmlapplicationviewer/qmlapplicationviewer.pri) |
@@ -0,0 +1,9 | |||||
|
1 | <RCC> | |||
|
2 | <qresource prefix="/"> | |||
|
3 | <file>qml/qmlaxes/loader.qml</file> | |||
|
4 | <file>qml/qmlaxes/main.qml</file> | |||
|
5 | <file>qml/qmlaxes/View1.qml</file> | |||
|
6 | <file>qml/qmlaxes/View2.qml</file> | |||
|
7 | <file>qml/qmlaxes/View3.qml</file> | |||
|
8 | </qresource> | |||
|
9 | </RCC> |
@@ -12,7 +12,8 SUBDIRS += piechartcustomization \ | |||||
12 | qmlf1legends \ |
|
12 | qmlf1legends \ | |
13 | qmlcustomizations \ |
|
13 | qmlcustomizations \ | |
14 | qmlcustommodel \ |
|
14 | qmlcustommodel \ | |
15 | chartinteractions |
|
15 | chartinteractions \ | |
|
16 | qmlaxes | |||
16 |
|
17 | |||
17 | contains(QT_CONFIG, opengl) { |
|
18 | contains(QT_CONFIG, opengl) { | |
18 | SUBDIRS += chartthemes \ |
|
19 | SUBDIRS += chartthemes \ |
@@ -18,6 +18,7 | |||||
18 | <li><a href="demos-nesteddonuts.html">Nested donuts chart</a></li> |
|
18 | <li><a href="demos-nesteddonuts.html">Nested donuts chart</a></li> | |
19 | <li><a href="demos-piechartcustomization.html">Pie chart customization</a></li> |
|
19 | <li><a href="demos-piechartcustomization.html">Pie chart customization</a></li> | |
20 | <li><a href="demos-qmlchart.html">Qml Basic Charts</a></li> |
|
20 | <li><a href="demos-qmlchart.html">Qml Basic Charts</a></li> | |
|
21 | <li><a href="demos-qmlaxes.html">Qml Axes</a></li> | |||
21 | <li><a href="demos-qmlcustomizations.html">Qml Customizations</a></li> |
|
22 | <li><a href="demos-qmlcustomizations.html">Qml Customizations</a></li> | |
22 | <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li> |
|
23 | <li><a href="demos-qmlcustommodel.html">Qml Custom Model</a></li> | |
23 | <li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li> |
|
24 | <li><a href="demos-qmlf1legends.html">Qml F1 Legends</a></li> |
@@ -72,6 +72,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
72 | /*! |
|
72 | /*! | |
73 | \qmlclass DateTimeAxis QDateTimeAxis |
|
73 | \qmlclass DateTimeAxis QDateTimeAxis | |
74 | \brief The DateTimeAxis element is used for manipulating chart's axes |
|
74 | \brief The DateTimeAxis element is used for manipulating chart's axes | |
|
75 | \inherits AbstractAxis | |||
75 |
|
76 | |||
76 | The labels can be configured by setting an appropriate DateTime format. |
|
77 | The labels can be configured by setting an appropriate DateTime format. | |
77 | Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored. |
|
78 | Note that any date before 4714 BCE or after about 1.4 million CE may not be accurately stored. | |
@@ -129,11 +130,31 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
129 | */ |
|
130 | */ | |
130 |
|
131 | |||
131 | /*! |
|
132 | /*! | |
132 |
\qmlproperty int |
|
133 | \qmlproperty int DateTimeAxis::tickCount | |
133 | The number of tick marks for the axis. |
|
134 | The number of tick marks for the axis. | |
134 | */ |
|
135 | */ | |
135 |
|
136 | |||
136 | /*! |
|
137 | /*! | |
|
138 | \property QDateTimeAxis::format | |||
|
139 | The format string that is used when creating label for the axis out of a QDateTime object. | |||
|
140 | Check QDateTime documentation for information on how the string should be defined. | |||
|
141 | */ | |||
|
142 | /*! | |||
|
143 | \qmlproperty string DateTimeAxis::format | |||
|
144 | The format string that is used when creating label for the axis out of a QDateTime object. | |||
|
145 | Check QDateTime documentation for information on how the string should be defined. | |||
|
146 | */ | |||
|
147 | ||||
|
148 | /*! | |||
|
149 | \fn void QDateTimeAxis::formatChanged(QString format) | |||
|
150 | Axis emits signal when \a format of the axis has changed. | |||
|
151 | */ | |||
|
152 | /*! | |||
|
153 | \qmlsignal DateTimeAxis::onFormatChanged(string format) | |||
|
154 | Axis emits signal when \a format of the axis has changed. | |||
|
155 | */ | |||
|
156 | ||||
|
157 | /*! | |||
137 | Constructs an axis object which is a child of \a parent. |
|
158 | Constructs an axis object which is a child of \a parent. | |
138 | */ |
|
159 | */ | |
139 | QDateTimeAxis::QDateTimeAxis(QObject *parent) : |
|
160 | QDateTimeAxis::QDateTimeAxis(QObject *parent) : | |
@@ -213,22 +234,15 void QDateTimeAxis::setRange(QDateTime min, QDateTime max) | |||||
213 | } |
|
234 | } | |
214 | } |
|
235 | } | |
215 |
|
236 | |||
216 | /*! |
|
|||
217 | Sets \a format string that is used when creating label for the axis out of the QDateTime object. |
|
|||
218 | Check QDateTime documentation for information on how the string should be defined. |
|
|||
219 | \sa format() |
|
|||
220 | */ |
|
|||
221 | void QDateTimeAxis::setFormat(QString format) |
|
237 | void QDateTimeAxis::setFormat(QString format) | |
222 | { |
|
238 | { | |
223 | Q_D(QDateTimeAxis); |
|
239 | Q_D(QDateTimeAxis); | |
|
240 | if (d->m_format != format) { | |||
224 | d->m_format = format; |
|
241 | d->m_format = format; | |
|
242 | emit formatChanged(format); | |||
|
243 | } | |||
225 | } |
|
244 | } | |
226 |
|
245 | |||
227 | /*! |
|
|||
228 | Returns the format string that is used when creating label for the axis out of the QDateTime object. |
|
|||
229 | Check QDateTime documentation for information on how the string should be defined. |
|
|||
230 | \sa setFormat() |
|
|||
231 | */ |
|
|||
232 | QString QDateTimeAxis::format() const |
|
246 | QString QDateTimeAxis::format() const | |
233 | { |
|
247 | { | |
234 | Q_D(const QDateTimeAxis); |
|
248 | Q_D(const QDateTimeAxis); |
@@ -35,6 +35,7 class QTCOMMERCIALCHART_EXPORT QDateTimeAxis : public QAbstractAxis | |||||
35 | Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount) |
|
35 | Q_PROPERTY(int tickCount READ tickCount WRITE setTickCount) | |
36 | Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged) |
|
36 | Q_PROPERTY(QDateTime min READ min WRITE setMin NOTIFY minChanged) | |
37 | Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged) |
|
37 | Q_PROPERTY(QDateTime max READ max WRITE setMax NOTIFY maxChanged) | |
|
38 | Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged) | |||
38 |
|
39 | |||
39 | public: |
|
40 | public: | |
40 | explicit QDateTimeAxis(QObject *parent = 0); |
|
41 | explicit QDateTimeAxis(QObject *parent = 0); | |
@@ -64,6 +65,7 Q_SIGNALS: | |||||
64 | void minChanged(QDateTime min); |
|
65 | void minChanged(QDateTime min); | |
65 | void maxChanged(QDateTime max); |
|
66 | void maxChanged(QDateTime max); | |
66 | void rangeChanged(QDateTime min, QDateTime max); |
|
67 | void rangeChanged(QDateTime min, QDateTime max); | |
|
68 | void formatChanged(QString format); | |||
67 |
|
69 | |||
68 | private: |
|
70 | private: | |
69 | Q_DECLARE_PRIVATE(QDateTimeAxis) |
|
71 | Q_DECLARE_PRIVATE(QDateTimeAxis) |
General Comments 0
You need to be logged in to leave comments.
Login now