@@ -0,0 +1,136 | |||
|
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.1 | |
|
22 | import QtCommercial.Chart 1.0 | |
|
23 | ||
|
24 | Rectangle { | |
|
25 | width: 360 | |
|
26 | height: 360 | |
|
27 | ||
|
28 | ChartView { | |
|
29 | id: chartView | |
|
30 | anchors.top: parent.top | |
|
31 | anchors.bottom: weatherImageRow.top | |
|
32 | anchors.left: parent.left | |
|
33 | anchors.right: parent.right | |
|
34 | axisX.min: 0 | |
|
35 | axisX.max: 6 | |
|
36 | axisY.min: 0 | |
|
37 | axisY.max: 50 | |
|
38 | ||
|
39 | // TODO: implement categories | |
|
40 | // AxisCategory { axis: AxisCategory.AxisX; value: 0.0; label: "" } | |
|
41 | // AxisCategory { axis: AxisCategory.AxisX; value: 1.0; label: "Today" } | |
|
42 | // AxisCategory { axis: AxisCategory.AxisX; value: 2.0; label: "Tomorrow" } | |
|
43 | // AxisCategory { axis: AxisCategory.AxisX; value: 3.0; label: "Day after tomorrow" } | |
|
44 | ||
|
45 | LineSeries { | |
|
46 | model: maxModel | |
|
47 | } | |
|
48 | ||
|
49 | LineSeries { | |
|
50 | model: minModel | |
|
51 | } | |
|
52 | ||
|
53 | // TODO: use a single base model with mappings instead of two separate xy models | |
|
54 | // LineSeries { | |
|
55 | // model: chartModel | |
|
56 | // modelMapping: XyModelMapping { | |
|
57 | // xColumn: 0 | |
|
58 | // yColumn: 1 | |
|
59 | // } | |
|
60 | // } | |
|
61 | // LineSeries { | |
|
62 | // model: chartModel | |
|
63 | // modelMapping: XyModelMapping { | |
|
64 | // xColumn: 0 | |
|
65 | // yColumn: 2 | |
|
66 | // } | |
|
67 | // } | |
|
68 | } | |
|
69 | ||
|
70 | // ChartModel { | |
|
71 | // id: chartModel | |
|
72 | // } | |
|
73 | ||
|
74 | XYModel { | |
|
75 | id: maxModel | |
|
76 | } | |
|
77 | ||
|
78 | XYModel { | |
|
79 | id: minModel | |
|
80 | } | |
|
81 | ||
|
82 | Component.onCompleted: { | |
|
83 | // TODO: use live data instead of hard coded example data | |
|
84 | // in case an application key was defined for this demo app | |
|
85 | // var xhr = new XMLHttpRequest; | |
|
86 | // var appKey = ""; | |
|
87 | // xhr.open("GET", "http://free.worldweatheronline.com/feed/weather.ashx?q=Jyv%c3%a4skyl%c3%a4,Finland&format=json&num_of_days=5&key=" + appKey"); | |
|
88 | // xhr.onreadystatechange = function() { | |
|
89 | // if (xhr.readyState == XMLHttpRequest.DONE) { | |
|
90 | // var a = JSON.parse(xhr.responseText); | |
|
91 | // console.log("a: " + a); | |
|
92 | // console.log("response: " + xhr.responseText); | |
|
93 | // for (var b in a) { | |
|
94 | // var o = a[b]; | |
|
95 | // console.log("o: " + o); | |
|
96 | //// model.append({id: o.id, name: o.name, duration: o.duration}); | |
|
97 | // } | |
|
98 | // } | |
|
99 | // } | |
|
100 | // xhr.send(); | |
|
101 | ||
|
102 | var responseText = "{ \"data\": { \"current_condition\": [ {\"cloudcover\": \"10\", \"humidity\": \"61\", \"observation_time\": \"06:26 AM\", \"precipMM\": \"0.0\", \"pressure\": \"1022\", \"temp_C\": \"6\", \"temp_F\": \"43\", \"visibility\": \"10\", \"weatherCode\": \"113\", \"weatherDesc\": [ {\"value\": \"Sunny\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0001_sunny.png\" } ], \"winddir16Point\": \"SE\", \"winddirDegree\": \"140\", \"windspeedKmph\": \"7\", \"windspeedMiles\": \"4\" } ], \"request\": [ {\"query\": \"Jyvaskyla, Finland\", \"type\": \"City\" } ], \"weather\": [ {\"date\": \"2012-05-09\", \"precipMM\": \"0.4\", \"tempMaxC\": \"14\", \"tempMaxF\": \"57\", \"tempMinC\": \"7\", \"tempMinF\": \"45\", \"weatherCode\": \"116\", \"weatherDesc\": [ {\"value\": \"Partly Cloudy\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png\" } ], \"winddir16Point\": \"S\", \"winddirDegree\": \"179\", \"winddirection\": \"S\", \"windspeedKmph\": \"20\", \"windspeedMiles\": \"12\" }, {\"date\": \"2012-05-10\", \"precipMM\": \"2.4\", \"tempMaxC\": \"13\", \"tempMaxF\": \"55\", \"tempMinC\": \"8\", \"tempMinF\": \"46\", \"weatherCode\": \"266\", \"weatherDesc\": [ {\"value\": \"Light drizzle\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png\" } ], \"winddir16Point\": \"SW\", \"winddirDegree\": \"219\", \"winddirection\": \"SW\", \"windspeedKmph\": \"21\", \"windspeedMiles\": \"13\" }, {\"date\": \"2012-05-11\", \"precipMM\": \"11.1\", \"tempMaxC\": \"15\", \"tempMaxF\": \"59\", \"tempMinC\": \"7\", \"tempMinF\": \"44\", \"weatherCode\": \"266\", \"weatherDesc\": [ {\"value\": \"Light drizzle\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0017_cloudy_with_light_rain.png\" } ], \"winddir16Point\": \"SSW\", \"winddirDegree\": \"200\", \"winddirection\": \"SSW\", \"windspeedKmph\": \"20\", \"windspeedMiles\": \"12\" }, {\"date\": \"2012-05-12\", \"precipMM\": \"2.8\", \"tempMaxC\": \"7\", \"tempMaxF\": \"44\", \"tempMinC\": \"2\", \"tempMinF\": \"35\", \"weatherCode\": \"317\", \"weatherDesc\": [ {\"value\": \"Light sleet\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0021_cloudy_with_sleet.png\" } ], \"winddir16Point\": \"NW\", \"winddirDegree\": \"311\", \"winddirection\": \"NW\", \"windspeedKmph\": \"24\", \"windspeedMiles\": \"15\" }, {\"date\": \"2012-05-13\", \"precipMM\": \"0.4\", \"tempMaxC\": \"6\", \"tempMaxF\": \"42\", \"tempMinC\": \"2\", \"tempMinF\": \"35\", \"weatherCode\": \"116\", \"weatherDesc\": [ {\"value\": \"Partly Cloudy\" } ], \"weatherIconUrl\": [ {\"value\": \"http:\/\/www.worldweatheronline.com\/images\/wsymbols01_png_64\/wsymbol_0002_sunny_intervals.png\" } ], \"winddir16Point\": \"WNW\", \"winddirDegree\": \"281\", \"winddirection\": \"WNW\", \"windspeedKmph\": \"21\", \"windspeedMiles\": \"13\" } ] }}"; | |
|
103 | var a = JSON.parse(responseText); | |
|
104 | ||
|
105 | for (var i in a.data.weather) { | |
|
106 | var weatherObj = a.data.weather[i]; | |
|
107 | maxModel.append([Number(i) + 1, weatherObj.tempMaxC]); | |
|
108 | minModel.append([Number(i) + 1, weatherObj.tempMinC]); | |
|
109 | weatherImageModel.append({"imageSource":weatherObj.weatherIconUrl[0].value}); | |
|
110 | } | |
|
111 | } | |
|
112 | ||
|
113 | ListModel { | |
|
114 | id: weatherImageModel | |
|
115 | } | |
|
116 | ||
|
117 | Row { | |
|
118 | id: weatherImageRow | |
|
119 | anchors.bottom: parent.bottom | |
|
120 | anchors.bottomMargin: 10 | |
|
121 | anchors.left: parent.left | |
|
122 | anchors.leftMargin: 25 | |
|
123 | anchors.right: parent.right | |
|
124 | anchors.rightMargin: 25 | |
|
125 | Repeater { | |
|
126 | id: repeater | |
|
127 | model: weatherImageModel | |
|
128 | delegate: Image { | |
|
129 | source: imageSource | |
|
130 | width: weatherImageRow.width / weatherImageModel.count | |
|
131 | height: width | |
|
132 | fillMode: Image.PreserveAspectCrop | |
|
133 | } | |
|
134 | } | |
|
135 | } | |
|
136 | } |
@@ -0,0 +1,174 | |||
|
1 | // checksum 0x3fbf version 0x70013 | |
|
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 <QDir> | |
|
14 | #include <QFileInfo> | |
|
15 | #include <QApplication> | |
|
16 | #include <QDeclarativeComponent> | |
|
17 | #include <QDeclarativeEngine> | |
|
18 | #include <QDeclarativeContext> | |
|
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 | QString mainQmlFile; | |
|
54 | friend class QmlApplicationViewer; | |
|
55 | static QString adjustPath(const QString &path); | |
|
56 | }; | |
|
57 | ||
|
58 | QString QmlApplicationViewerPrivate::adjustPath(const QString &path) | |
|
59 | { | |
|
60 | #ifdef Q_OS_UNIX | |
|
61 | #ifdef Q_OS_MAC | |
|
62 | if (!QDir::isAbsolutePath(path)) | |
|
63 | return QString::fromLatin1("%1/../Resources/%2") | |
|
64 | .arg(QCoreApplication::applicationDirPath(), path); | |
|
65 | #else | |
|
66 | const QString pathInInstallDir = | |
|
67 | QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path); | |
|
68 | if (QFileInfo(pathInInstallDir).exists()) | |
|
69 | return pathInInstallDir; | |
|
70 | #endif | |
|
71 | #endif | |
|
72 | return path; | |
|
73 | } | |
|
74 | ||
|
75 | QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) | |
|
76 | : QDeclarativeView(parent) | |
|
77 | , d(new QmlApplicationViewerPrivate()) | |
|
78 | { | |
|
79 | connect(engine(), SIGNAL(quit()), SLOT(close())); | |
|
80 | setResizeMode(QDeclarativeView::SizeRootObjectToView); | |
|
81 | // Qt versions prior to 4.8.0 don't have QML/JS debugging services built in | |
|
82 | #if defined(QMLJSDEBUGGER) && QT_VERSION < 0x040800 | |
|
83 | #if !defined(NO_JSDEBUGGER) | |
|
84 | new QmlJSDebugger::JSDebuggerAgent(engine()); | |
|
85 | #endif | |
|
86 | #if !defined(NO_QMLOBSERVER) | |
|
87 | new QmlJSDebugger::QDeclarativeViewObserver(this, this); | |
|
88 | #endif | |
|
89 | #endif | |
|
90 | } | |
|
91 | ||
|
92 | QmlApplicationViewer::~QmlApplicationViewer() | |
|
93 | { | |
|
94 | delete d; | |
|
95 | } | |
|
96 | ||
|
97 | QmlApplicationViewer *QmlApplicationViewer::create() | |
|
98 | { | |
|
99 | return new QmlApplicationViewer(); | |
|
100 | } | |
|
101 | ||
|
102 | void QmlApplicationViewer::setMainQmlFile(const QString &file) | |
|
103 | { | |
|
104 | d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); | |
|
105 | setSource(QUrl::fromLocalFile(d->mainQmlFile)); | |
|
106 | } | |
|
107 | ||
|
108 | void QmlApplicationViewer::addImportPath(const QString &path) | |
|
109 | { | |
|
110 | engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); | |
|
111 | } | |
|
112 | ||
|
113 | void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) | |
|
114 | { | |
|
115 | #if defined(Q_OS_SYMBIAN) | |
|
116 | // If the version of Qt on the device is < 4.7.2, that attribute won't work | |
|
117 | if (orientation != ScreenOrientationAuto) { | |
|
118 | const QStringList v = QString::fromLatin1(qVersion()).split(QLatin1Char('.')); | |
|
119 | if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { | |
|
120 | qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); | |
|
121 | return; | |
|
122 | } | |
|
123 | } | |
|
124 | #endif // Q_OS_SYMBIAN | |
|
125 | ||
|
126 | Qt::WidgetAttribute attribute; | |
|
127 | switch (orientation) { | |
|
128 | #if QT_VERSION < 0x040702 | |
|
129 | // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes | |
|
130 | case ScreenOrientationLockPortrait: | |
|
131 | attribute = static_cast<Qt::WidgetAttribute>(128); | |
|
132 | break; | |
|
133 | case ScreenOrientationLockLandscape: | |
|
134 | attribute = static_cast<Qt::WidgetAttribute>(129); | |
|
135 | break; | |
|
136 | default: | |
|
137 | case ScreenOrientationAuto: | |
|
138 | attribute = static_cast<Qt::WidgetAttribute>(130); | |
|
139 | break; | |
|
140 | #else // QT_VERSION < 0x040702 | |
|
141 | case ScreenOrientationLockPortrait: | |
|
142 | attribute = Qt::WA_LockPortraitOrientation; | |
|
143 | break; | |
|
144 | case ScreenOrientationLockLandscape: | |
|
145 | attribute = Qt::WA_LockLandscapeOrientation; | |
|
146 | break; | |
|
147 | default: | |
|
148 | case ScreenOrientationAuto: | |
|
149 | attribute = Qt::WA_AutoOrientation; | |
|
150 | break; | |
|
151 | #endif // QT_VERSION < 0x040702 | |
|
152 | }; | |
|
153 | setAttribute(attribute, true); | |
|
154 | } | |
|
155 | ||
|
156 | void QmlApplicationViewer::showExpanded() | |
|
157 | { | |
|
158 | #if defined(Q_OS_SYMBIAN) || defined(MEEGO_EDITION_HARMATTAN) || defined(Q_WS_SIMULATOR) | |
|
159 | showFullScreen(); | |
|
160 | #elif defined(Q_WS_MAEMO_5) | |
|
161 | showMaximized(); | |
|
162 | #else | |
|
163 | show(); | |
|
164 | #endif | |
|
165 | } | |
|
166 | ||
|
167 | QApplication *createApplication(int &argc, char **argv) | |
|
168 | { | |
|
169 | #ifdef HARMATTAN_BOOSTER | |
|
170 | return MDeclarativeCache::qApplication(argc, argv); | |
|
171 | #else | |
|
172 | return new QApplication(argc, argv); | |
|
173 | #endif | |
|
174 | } |
@@ -0,0 +1,46 | |||
|
1 | // checksum 0x734b version 0x70013 | |
|
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 <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 | class QmlApplicationViewerPrivate *d; | |
|
42 | }; | |
|
43 | ||
|
44 | QApplication *createApplication(int &argc, char **argv); | |
|
45 | ||
|
46 | #endif // QMLAPPLICATIONVIEWER_H |
@@ -0,0 +1,148 | |||
|
1 | # checksum 0x5b42 version 0x70013 | |
|
2 | # This file was generated by the Qt Quick Application wizard of Qt Creator. | |
|
3 | # The code below adds the QmlApplicationViewer to the project and handles the | |
|
4 | # activation of QML debugging. | |
|
5 | # It is recommended not to modify this file, since newer versions of Qt Creator | |
|
6 | # may offer an updated version of it. | |
|
7 | ||
|
8 | QT += declarative | |
|
9 | ||
|
10 | SOURCES += $$PWD/qmlapplicationviewer.cpp | |
|
11 | HEADERS += $$PWD/qmlapplicationviewer.h | |
|
12 | INCLUDEPATH += $$PWD | |
|
13 | ||
|
14 | # Include JS debugger library if QMLJSDEBUGGER_PATH is set | |
|
15 | !isEmpty(QMLJSDEBUGGER_PATH) { | |
|
16 | include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri) | |
|
17 | } else { | |
|
18 | DEFINES -= QMLJSDEBUGGER | |
|
19 | } | |
|
20 | ||
|
21 | contains(CONFIG,qdeclarative-boostable):contains(MEEGO_EDITION,harmattan) { | |
|
22 | DEFINES += HARMATTAN_BOOSTER | |
|
23 | } | |
|
24 | # This file was generated by an application wizard of Qt Creator. | |
|
25 | # The code below handles deployment to Symbian and Maemo, aswell as copying | |
|
26 | # of the application data to shadow build directories on desktop. | |
|
27 | # It is recommended not to modify this file, since newer versions of Qt Creator | |
|
28 | # may offer an updated version of it. | |
|
29 | ||
|
30 | defineTest(qtcAddDeployment) { | |
|
31 | for(deploymentfolder, DEPLOYMENTFOLDERS) { | |
|
32 | item = item$${deploymentfolder} | |
|
33 | itemsources = $${item}.sources | |
|
34 | $$itemsources = $$eval($${deploymentfolder}.source) | |
|
35 | itempath = $${item}.path | |
|
36 | $$itempath= $$eval($${deploymentfolder}.target) | |
|
37 | export($$itemsources) | |
|
38 | export($$itempath) | |
|
39 | DEPLOYMENT += $$item | |
|
40 | } | |
|
41 | ||
|
42 | MAINPROFILEPWD = $$PWD | |
|
43 | ||
|
44 | symbian { | |
|
45 | isEmpty(ICON):exists($${TARGET}.svg):ICON = $${TARGET}.svg | |
|
46 | isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 | |
|
47 | } else:win32 { | |
|
48 | copyCommand = | |
|
49 | for(deploymentfolder, DEPLOYMENTFOLDERS) { | |
|
50 | source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) | |
|
51 | source = $$replace(source, /, \\) | |
|
52 | sourcePathSegments = $$split(source, \\) | |
|
53 | target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments) | |
|
54 | target = $$replace(target, /, \\) | |
|
55 | target ~= s,\\\\\\.?\\\\,\\, | |
|
56 | !isEqual(source,$$target) { | |
|
57 | !isEmpty(copyCommand):copyCommand += && | |
|
58 | isEqual(QMAKE_DIR_SEP, \\) { | |
|
59 | copyCommand += $(COPY_DIR) \"$$source\" \"$$target\" | |
|
60 | } else { | |
|
61 | source = $$replace(source, \\\\, /) | |
|
62 | target = $$OUT_PWD/$$eval($${deploymentfolder}.target) | |
|
63 | target = $$replace(target, \\\\, /) | |
|
64 | copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\" | |
|
65 | } | |
|
66 | } | |
|
67 | } | |
|
68 | !isEmpty(copyCommand) { | |
|
69 | copyCommand = @echo Copying application data... && $$copyCommand | |
|
70 | copydeploymentfolders.commands = $$copyCommand | |
|
71 | first.depends = $(first) copydeploymentfolders | |
|
72 | export(first.depends) | |
|
73 | export(copydeploymentfolders.commands) | |
|
74 | QMAKE_EXTRA_TARGETS += first copydeploymentfolders | |
|
75 | } | |
|
76 | } else:unix { | |
|
77 | maemo5 { | |
|
78 | desktopfile.files = $${TARGET}.desktop | |
|
79 | desktopfile.path = /usr/share/applications/hildon | |
|
80 | icon.files = $${TARGET}64.png | |
|
81 | icon.path = /usr/share/icons/hicolor/64x64/apps | |
|
82 | } else:!isEmpty(MEEGO_VERSION_MAJOR) { | |
|
83 | desktopfile.files = $${TARGET}_harmattan.desktop | |
|
84 | desktopfile.path = /usr/share/applications | |
|
85 | icon.files = $${TARGET}80.png | |
|
86 | icon.path = /usr/share/icons/hicolor/80x80/apps | |
|
87 | } else { # Assumed to be a Desktop Unix | |
|
88 | copyCommand = | |
|
89 | for(deploymentfolder, DEPLOYMENTFOLDERS) { | |
|
90 | source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source) | |
|
91 | source = $$replace(source, \\\\, /) | |
|
92 | macx { | |
|
93 | target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target) | |
|
94 | } else { | |
|
95 | target = $$OUT_PWD/$$eval($${deploymentfolder}.target) | |
|
96 | } | |
|
97 | target = $$replace(target, \\\\, /) | |
|
98 | sourcePathSegments = $$split(source, /) | |
|
99 | targetFullPath = $$target/$$last(sourcePathSegments) | |
|
100 | targetFullPath ~= s,/\\.?/,/, | |
|
101 | !isEqual(source,$$targetFullPath) { | |
|
102 | !isEmpty(copyCommand):copyCommand += && | |
|
103 | copyCommand += $(MKDIR) \"$$target\" | |
|
104 | copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\" | |
|
105 | } | |
|
106 | } | |
|
107 | !isEmpty(copyCommand) { | |
|
108 | copyCommand = @echo Copying application data... && $$copyCommand | |
|
109 | copydeploymentfolders.commands = $$copyCommand | |
|
110 | first.depends = $(first) copydeploymentfolders | |
|
111 | export(first.depends) | |
|
112 | export(copydeploymentfolders.commands) | |
|
113 | QMAKE_EXTRA_TARGETS += first copydeploymentfolders | |
|
114 | } | |
|
115 | } | |
|
116 | installPrefix = /opt/$${TARGET} | |
|
117 | for(deploymentfolder, DEPLOYMENTFOLDERS) { | |
|
118 | item = item$${deploymentfolder} | |
|
119 | itemfiles = $${item}.files | |
|
120 | $$itemfiles = $$eval($${deploymentfolder}.source) | |
|
121 | itempath = $${item}.path | |
|
122 | $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target) | |
|
123 | export($$itemfiles) | |
|
124 | export($$itempath) | |
|
125 | INSTALLS += $$item | |
|
126 | } | |
|
127 | ||
|
128 | !isEmpty(desktopfile.path) { | |
|
129 | export(icon.files) | |
|
130 | export(icon.path) | |
|
131 | export(desktopfile.files) | |
|
132 | export(desktopfile.path) | |
|
133 | INSTALLS += icon desktopfile | |
|
134 | } | |
|
135 | ||
|
136 | target.path = $${installPrefix}/bin | |
|
137 | export(target.path) | |
|
138 | INSTALLS += target | |
|
139 | } | |
|
140 | ||
|
141 | export (ICON) | |
|
142 | export (INSTALLS) | |
|
143 | export (DEPLOYMENT) | |
|
144 | export (TARGET.EPOCHEAPSIZE) | |
|
145 | export (TARGET.CAPABILITY) | |
|
146 | export (LIBS) | |
|
147 | export (QMAKE_EXTRA_TARGETS) | |
|
148 | } |
@@ -0,0 +1,11 | |||
|
1 | [Desktop Entry] | |
|
2 | Encoding=UTF-8 | |
|
3 | Version=1.0 | |
|
4 | Type=Application | |
|
5 | Terminal=false | |
|
6 | Name=qmlweather | |
|
7 | Exec=/opt/qmlweather/bin/qmlweather | |
|
8 | Icon=qmlweather64 | |
|
9 | X-Window-Icon= | |
|
10 | X-HildonDesk-ShowInToolbar=true | |
|
11 | X-Osso-Type=application/x-executable |
@@ -0,0 +1,11 | |||
|
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) | |
|
9 | #qtcAddDeployment() | |
|
10 | ||
|
11 | !system_build:mac: QMAKE_POST_LINK += "$$MAC_POST_LINK_PREFIX $$MAC_DEMOS_BIN_DIR" |
@@ -0,0 +1,93 | |||
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
|
2 | <svg | |
|
3 | xmlns:dc="http://purl.org/dc/elements/1.1/" | |
|
4 | xmlns:cc="http://creativecommons.org/ns#" | |
|
5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | |
|
6 | xmlns:svg="http://www.w3.org/2000/svg" | |
|
7 | xmlns="http://www.w3.org/2000/svg" | |
|
8 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | |
|
9 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | |
|
10 | height="44px" | |
|
11 | version="1.1" | |
|
12 | viewBox="0 0 44 44" | |
|
13 | width="44px" | |
|
14 | x="0px" | |
|
15 | y="0px" | |
|
16 | id="svg2" | |
|
17 | inkscape:version="0.47 r22583" | |
|
18 | sodipodi:docname="qt.svg"> | |
|
19 | <metadata | |
|
20 | id="metadata18"> | |
|
21 | <rdf:RDF> | |
|
22 | <cc:Work | |
|
23 | rdf:about=""> | |
|
24 | <dc:format>image/svg+xml</dc:format> | |
|
25 | <dc:type | |
|
26 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | |
|
27 | </cc:Work> | |
|
28 | </rdf:RDF> | |
|
29 | </metadata> | |
|
30 | <defs | |
|
31 | id="defs16"> | |
|
32 | <inkscape:perspective | |
|
33 | sodipodi:type="inkscape:persp3d" | |
|
34 | inkscape:vp_x="0 : 22 : 1" | |
|
35 | inkscape:vp_y="0 : 1000 : 0" | |
|
36 | inkscape:vp_z="44 : 22 : 1" | |
|
37 | inkscape:persp3d-origin="22 : 14.666667 : 1" | |
|
38 | id="perspective2836" /> | |
|
39 | </defs> | |
|
40 | <sodipodi:namedview | |
|
41 | pagecolor="#ffffff" | |
|
42 | bordercolor="#666666" | |
|
43 | borderopacity="1" | |
|
44 | objecttolerance="10" | |
|
45 | gridtolerance="10" | |
|
46 | guidetolerance="10" | |
|
47 | inkscape:pageopacity="0" | |
|
48 | inkscape:pageshadow="2" | |
|
49 | inkscape:window-width="1920" | |
|
50 | inkscape:window-height="1020" | |
|
51 | id="namedview14" | |
|
52 | showgrid="false" | |
|
53 | inkscape:zoom="21.454545" | |
|
54 | inkscape:cx="49.412871" | |
|
55 | inkscape:cy="21.894358" | |
|
56 | inkscape:window-x="-4" | |
|
57 | inkscape:window-y="-4" | |
|
58 | inkscape:window-maximized="1" | |
|
59 | inkscape:current-layer="g3" /> | |
|
60 | <g | |
|
61 | transform="matrix(0.18308778,0,0,0.18308778,6.6100946,3.2385199)" | |
|
62 | id="g3"> | |
|
63 | <path | |
|
64 | d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" | |
|
65 | style="fill:#006225" | |
|
66 | id="path5" | |
|
67 | sodipodi:nodetypes="cccccccc" /> | |
|
68 | <path | |
|
69 | d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" | |
|
70 | style="fill:#80c342" | |
|
71 | id="path7" /> | |
|
72 | <path | |
|
73 | d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" | |
|
74 | style="fill:#006225" | |
|
75 | id="path11" /> | |
|
76 | <path | |
|
77 | d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" | |
|
78 | style="fill:#006225" | |
|
79 | id="path13" /> | |
|
80 | <path | |
|
81 | id="path17" | |
|
82 | style="fill:#ffffff" | |
|
83 | d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" /> | |
|
84 | <path | |
|
85 | d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" | |
|
86 | style="fill:#006225" | |
|
87 | id="path19" /> | |
|
88 | <path | |
|
89 | id="path21" | |
|
90 | style="fill:#006225" | |
|
91 | d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" /> | |
|
92 | </g> | |
|
93 | </svg> |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,11 | |||
|
1 | [Desktop Entry] | |
|
2 | Encoding=UTF-8 | |
|
3 | Version=1.0 | |
|
4 | Type=Application | |
|
5 | Terminal=false | |
|
6 | Name=qmlweather | |
|
7 | Exec=/usr/bin/single-instance /opt/qmlweather/bin/qmlweather | |
|
8 | Icon=/usr/share/icons/hicolor/80x80/apps/qmlweather80.png | |
|
9 | X-Window-Icon= | |
|
10 | X-HildonDesk-ShowInToolbar=true | |
|
11 | X-Osso-Type=application/x-executable |
@@ -0,0 +1,5 | |||
|
1 | <RCC> | |
|
2 | <qresource prefix="/"> | |
|
3 | <file>qml/qmlweather/main.qml</file> | |
|
4 | </qresource> | |
|
5 | </RCC> |
@@ -6,5 +6,6 CURRENTLY_BUILDING_COMPONENTS = "demos" | |||
|
6 | 6 | TEMPLATE = subdirs |
|
7 | 7 | SUBDIRS += chartthemes \ |
|
8 | 8 | piechartcustomization \ |
|
9 | dynamicspline \ | |
|
9 | 10 | qmlchart \ |
|
10 | dynamicspline | |
|
11 | qmlweather |
@@ -18,41 +18,17 | |||
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | #ifndef DECLARATIVE_AXIS_H | |
|
22 | #define DECLARATIVE_AXIS_H | |
|
21 | #include <QApplication> | |
|
22 | #include "qmlapplicationviewer.h" | |
|
23 | 23 | |
|
24 | #include "qchartglobal.h" | |
|
25 | #include <QAxis> | |
|
26 | #include <QDeclarativeParserStatus> | |
|
27 | ||
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
|
29 | ||
|
30 | class DeclarativeAxis: public QAxis, public QDeclarativeParserStatus | |
|
24 | Q_DECL_EXPORT int main(int argc, char *argv[]) | |
|
31 | 25 | { |
|
32 | Q_INTERFACES(QDeclarativeParserStatus) | |
|
33 | Q_OBJECT | |
|
34 | Q_PROPERTY(AxisRole role READ role WRITE setRole /*NOTIFY roleChanged*/) | |
|
35 | Q_ENUMS(AxisRole) | |
|
36 | ||
|
37 | public: | |
|
38 | enum AxisRole { | |
|
39 | RoleX = 0, | |
|
40 | RoleY | |
|
41 | }; | |
|
42 | ||
|
43 | public: | |
|
44 | explicit DeclarativeAxis(QObject *parent = 0); | |
|
45 | ||
|
46 | public: // from QDeclarativeParserStatus | |
|
47 | virtual void classBegin(); | |
|
48 | virtual void componentComplete(); | |
|
49 | ||
|
50 | public: | |
|
51 | void setRole(AxisRole role); | |
|
52 | AxisRole role() { return m_role; } | |
|
53 | AxisRole m_role; | |
|
54 | }; | |
|
26 | QScopedPointer<QApplication> app(createApplication(argc, argv)); | |
|
55 | 27 | |
|
56 | QTCOMMERCIALCHART_END_NAMESPACE | |
|
28 | QmlApplicationViewer viewer; | |
|
29 | viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); | |
|
30 | viewer.setSource(QUrl("qrc:/qml/qmlweather/main.qml")); | |
|
31 | viewer.showExpanded(); | |
|
57 | 32 | |
|
58 | #endif // DECLARATIVE_AXIS_H | |
|
33 | return app->exec(); | |
|
34 | } |
@@ -19,7 +19,6 | |||
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #include "declarativechart.h" |
|
22 | #include "declarativepieseries.h" | |
|
23 | 22 | #include <QPainter> |
|
24 | 23 | |
|
25 | 24 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
@@ -30,6 +29,7 DeclarativeChart::DeclarativeChart(QDeclarativeItem *parent) | |||
|
30 | 29 | m_legend(LegendDisabled) |
|
31 | 30 | { |
|
32 | 31 | setFlag(QGraphicsItem::ItemHasNoContents, false); |
|
32 | m_chart->axisX()->setNiceNumbersEnabled(false); | |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | DeclarativeChart::~DeclarativeChart() |
@@ -48,17 +48,20 void DeclarativeChart::childEvent(QChildEvent *event) | |||
|
48 | 48 | |
|
49 | 49 | void DeclarativeChart::componentComplete() |
|
50 | 50 | { |
|
51 | // qDebug() << "DeclarativeChart::componentComplete(), maxX: " << axisX()->max(); | |
|
51 | 52 | foreach(QObject *child, children()) { |
|
52 | 53 | if (qobject_cast<QAbstractSeries *>(child)) { |
|
53 | 54 | m_chart->addSeries(qobject_cast<QAbstractSeries *>(child)); |
|
54 | 55 | } |
|
55 | 56 | } |
|
57 | // qDebug() << "DeclarativeChart::componentComplete(), maxX: " << axisX()->max(); | |
|
56 | 58 | |
|
57 | 59 | QDeclarativeItem::componentComplete(); |
|
58 | 60 | } |
|
59 | 61 | |
|
60 | 62 | void DeclarativeChart::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) |
|
61 | 63 | { |
|
64 | // qDebug() << "DeclarativeChart::geometryChanged" << newGeometry.width() << newGeometry.height(); | |
|
62 | 65 | Q_UNUSED(oldGeometry) |
|
63 | 66 | |
|
64 | 67 | if (newGeometry.isValid()) { |
@@ -130,6 +133,16 DeclarativeChart::ChartLegend DeclarativeChart::legend() | |||
|
130 | 133 | return m_legend; |
|
131 | 134 | } |
|
132 | 135 | |
|
136 | QAxis *DeclarativeChart::axisX() | |
|
137 | { | |
|
138 | return m_chart->axisX(); | |
|
139 | } | |
|
140 | ||
|
141 | QAxis *DeclarativeChart::axisY() | |
|
142 | { | |
|
143 | return m_chart->axisY(); | |
|
144 | } | |
|
145 | ||
|
133 | 146 | #include "moc_declarativechart.cpp" |
|
134 | 147 | |
|
135 | 148 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -24,6 +24,7 | |||
|
24 | 24 | #include <QtCore/QtGlobal> |
|
25 | 25 | #include <QDeclarativeItem> |
|
26 | 26 | #include <qchart.h> |
|
27 | #include <QAxis> | |
|
27 | 28 | |
|
28 | 29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 30 | |
@@ -37,6 +38,8 class DeclarativeChart : public QDeclarativeItem | |||
|
37 | 38 | Q_PROPERTY(QChart::AnimationOption animationOptions READ animationOptions WRITE setAnimationOptions) |
|
38 | 39 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
39 | 40 | Q_PROPERTY(ChartLegend legend READ legend WRITE setLegend) |
|
41 | Q_PROPERTY(QAxis *axisX READ axisX) | |
|
42 | Q_PROPERTY(QAxis *axisY READ axisY) | |
|
40 | 43 | Q_ENUMS(ChartLegend) |
|
41 | 44 | |
|
42 | 45 | public: |
@@ -67,6 +70,8 public: | |||
|
67 | 70 | QString title() { return m_chart->title();} |
|
68 | 71 | void setLegend(ChartLegend legend); |
|
69 | 72 | ChartLegend legend(); |
|
73 | QAxis *axisX(); | |
|
74 | QAxis *axisY(); | |
|
70 | 75 | |
|
71 | 76 | public: |
|
72 | 77 | // Extending QChart with DeclarativeChart is not possible because QObject does not support |
@@ -30,11 +30,6 DeclarativeLineSeries::DeclarativeLineSeries(QObject *parent) : | |||
|
30 | 30 | { |
|
31 | 31 | } |
|
32 | 32 | |
|
33 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeLineSeries::points() | |
|
34 | { | |
|
35 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); | |
|
36 | } | |
|
37 | ||
|
38 | 33 | #include "moc_declarativelineseries.cpp" |
|
39 | 34 | |
|
40 | 35 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -31,13 +31,10 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
31 | 31 | class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries |
|
32 | 32 | { |
|
33 | 33 | Q_OBJECT |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
|
34 | Q_PROPERTY(DeclarativeXyModel *model READ declarativeModel WRITE setDeclarativeModel) | |
|
35 | 35 | |
|
36 | 36 | public: |
|
37 | 37 | explicit DeclarativeLineSeries(QObject *parent = 0); |
|
38 | ||
|
39 | public: | |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
|
41 | 38 | }; |
|
42 | 39 | |
|
43 | 40 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -18,29 +18,79 | |||
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 |
#include "declarative |
|
|
22 | #include "declarativechart.h" | |
|
23 | #include "qchart.h" | |
|
21 | #include "declarativemodel.h" | |
|
24 | 22 | #include <qdeclarativelist.h> |
|
23 | #include <QDebug> | |
|
25 | 24 | |
|
26 | 25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | 26 | |
|
28 | DeclarativePieModel::DeclarativePieModel(QObject *parent) : | |
|
27 | ////////////// XY model /////////////////////// | |
|
28 | ||
|
29 | DeclarativeXyModel::DeclarativeXyModel(QObject *parent) : | |
|
29 | 30 | ChartTableModel(parent) |
|
30 | 31 | { |
|
31 | 32 | } |
|
32 | 33 | |
|
33 |
|
|
|
34 | //{ | |
|
35 | //} | |
|
34 | void DeclarativeXyModel::append(DeclarativeXyPoint* point) | |
|
35 | { | |
|
36 | // qDebug() << "DeclarativeXyModel::append:" << point->x() << " " << point->y(); | |
|
37 | insertRow(rowCount()); | |
|
38 | QModelIndex xModelIndex = createIndex(rowCount() - 1, 0); | |
|
39 | QModelIndex yModelIndex = createIndex(rowCount() - 1, 1); | |
|
40 | setData(xModelIndex, point->x()); | |
|
41 | setData(yModelIndex, point->y()); | |
|
42 | dataChanged(xModelIndex, yModelIndex); | |
|
43 | } | |
|
36 | 44 | |
|
37 | //void DeclarativePieModel::componentComplete() | |
|
38 | //{ | |
|
39 | //} | |
|
45 | void DeclarativeXyModel::append(QVariantList points) | |
|
46 | { | |
|
47 | qreal x = 0.0; | |
|
48 | for (int i(0); i < points.count(); i++) { | |
|
49 | if (i % 2) { | |
|
50 | bool ok(false); | |
|
51 | qreal y = points.at(i).toReal(&ok); | |
|
52 | if (ok) { | |
|
53 | DeclarativeXyPoint *point= new DeclarativeXyPoint(); | |
|
54 | point->setX(x); | |
|
55 | point->setY(y); | |
|
56 | append(point); | |
|
57 | } else { | |
|
58 | qWarning() << "Illegal y value"; | |
|
59 | } | |
|
60 | } else { | |
|
61 | bool ok(false); | |
|
62 | x = points.at(i).toReal(&ok); | |
|
63 | if (!ok) { | |
|
64 | qWarning() << "Illegal x value"; | |
|
65 | } | |
|
66 | } | |
|
67 | } | |
|
68 | } | |
|
69 | ||
|
70 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeXyModel::points() | |
|
71 | { | |
|
72 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXyModel::appendPoint); | |
|
73 | } | |
|
74 | ||
|
75 | void DeclarativeXyModel::appendPoint(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
|
76 | DeclarativeXyPoint *point) | |
|
77 | { | |
|
78 | DeclarativeXyModel *model = qobject_cast<DeclarativeXyModel *>(list->object); | |
|
79 | if (model) | |
|
80 | model->append(point); | |
|
81 | else | |
|
82 | qWarning() << "Illegal point item"; | |
|
83 | } | |
|
84 | ||
|
85 | ////////////// Pie model /////////////////////// | |
|
86 | ||
|
87 | DeclarativePieModel::DeclarativePieModel(QObject *parent) : | |
|
88 | ChartTableModel(parent) | |
|
89 | { | |
|
90 | } | |
|
40 | 91 | |
|
41 | 92 | void DeclarativePieModel::append(QPieSlice* slice) |
|
42 | 93 | { |
|
43 | // TODO: label not working... | |
|
44 | 94 | qDebug() << "DeclarativePieModel::append:" << slice->label() << " " << slice->value(); |
|
45 | 95 | qDebug() << "rowCount:" << rowCount(); |
|
46 | 96 | qDebug() << "coolCount:" << columnCount(); |
@@ -62,6 +112,8 void DeclarativePieModel::append(QVariantList slices) | |||
|
62 | 112 | if (ok) { |
|
63 | 113 | QPieSlice *slice = new QPieSlice(value, label); |
|
64 | 114 | append(slice); |
|
115 | } else { | |
|
116 | qWarning() << "Illegal slice item"; | |
|
65 | 117 | } |
|
66 | 118 | } else { |
|
67 | 119 | label = slices.at(i).toString(); |
@@ -84,6 +136,6 void DeclarativePieModel::appendSlice(QDeclarativeListProperty<QPieSlice> *list, | |||
|
84 | 136 | qWarning() << "Illegal slice item"; |
|
85 | 137 | } |
|
86 | 138 | |
|
87 |
#include "moc_declarative |
|
|
139 | #include "moc_declarativemodel.cpp" | |
|
88 | 140 | |
|
89 | 141 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -18,23 +18,38 | |||
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 |
#ifndef DECLARATIVE |
|
|
22 |
#define DECLARATIVE |
|
|
21 | #ifndef DECLARATIVEMODEL_H | |
|
22 | #define DECLARATIVEMODEL_H | |
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | #include "declarativexypoint.h" | |
|
25 | 26 | #include "qpieslice.h" |
|
26 | #include "qpieseries.h" | |
|
27 | #include "../src/charttablemodel.h" | |
|
28 | #include <QDeclarativeParserStatus> | |
|
27 | #include "../src/charttablemodel.h" // TODO | |
|
29 | 28 | #include <QDeclarativeListProperty> |
|
30 | #include <QAbstractItemModel> | |
|
31 | 29 | #include <QVariant> |
|
32 | 30 | |
|
33 | 31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
34 | 32 | |
|
35 |
class Declarative |
|
|
33 | class DeclarativeXyModel : public ChartTableModel | |
|
34 | { | |
|
35 | Q_OBJECT | |
|
36 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
|
37 | Q_CLASSINFO("DefaultProperty", "points") | |
|
38 | ||
|
39 | public: | |
|
40 | explicit DeclarativeXyModel(QObject *parent = 0); | |
|
41 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
|
42 | ||
|
43 | public Q_SLOTS: | |
|
44 | void append(DeclarativeXyPoint* point); | |
|
45 | void append(QVariantList points); | |
|
46 | static void appendPoint(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
|
47 | DeclarativeXyPoint *element); | |
|
48 | }; | |
|
49 | ||
|
50 | ||
|
51 | class DeclarativePieModel : public ChartTableModel | |
|
36 | 52 | { |
|
37 | // Q_INTERFACES(QDeclarativeParserStatus) | |
|
38 | 53 | Q_OBJECT |
|
39 | 54 | Q_PROPERTY(QDeclarativeListProperty<QPieSlice> slices READ slices) |
|
40 | 55 | Q_CLASSINFO("DefaultProperty", "slices") |
@@ -43,19 +58,13 public: | |||
|
43 | 58 | explicit DeclarativePieModel(QObject *parent = 0); |
|
44 | 59 | QDeclarativeListProperty<QPieSlice> slices(); |
|
45 | 60 | |
|
46 | //public: // from QDeclarativeParserStatus | |
|
47 | // virtual void classBegin(); | |
|
48 | // virtual void componentComplete(); | |
|
49 | ||
|
50 | 61 | public Q_SLOTS: |
|
51 | 62 | void append(QPieSlice* slice); |
|
52 | 63 | void append(QVariantList slices); |
|
53 | 64 | static void appendSlice(QDeclarativeListProperty<QPieSlice> *list, |
|
54 | 65 | QPieSlice *element); |
|
55 | ||
|
56 | public: | |
|
57 | 66 | }; |
|
58 | 67 | |
|
59 | 68 | QTCOMMERCIALCHART_END_NAMESPACE |
|
60 | 69 | |
|
61 |
#endif // DECLARATIVE |
|
|
70 | #endif // DECLARATIVEMODEL_H |
@@ -37,6 +37,8 bool DeclarativePieSeries::setPieModel(DeclarativePieModel *model) | |||
|
37 | 37 | if (m) { |
|
38 | 38 | value = QPieSeries::setModel(m); |
|
39 | 39 | setModelMapping(0, 1, Qt::Vertical); |
|
40 | } else { | |
|
41 | qWarning("DeclarativePieSeries: Illegal model"); | |
|
40 | 42 | } |
|
41 | 43 | return value; |
|
42 | 44 | } |
@@ -27,7 +27,7 | |||
|
27 | 27 | #include <QDeclarativeListProperty> |
|
28 | 28 | #include <QAbstractItemModel> |
|
29 | 29 | #include <QVariant> |
|
30 |
#include "declarative |
|
|
30 | #include "declarativemodel.h" | |
|
31 | 31 | |
|
32 | 32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | 33 |
@@ -30,11 +30,6 DeclarativeScatterSeries::DeclarativeScatterSeries(QObject *parent) : | |||
|
30 | 30 | { |
|
31 | 31 | } |
|
32 | 32 | |
|
33 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeScatterSeries::points() | |
|
34 | { | |
|
35 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); | |
|
36 | } | |
|
37 | ||
|
38 | 33 | #include "moc_declarativescatterseries.cpp" |
|
39 | 34 | |
|
40 | 35 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -31,13 +31,10 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
31 | 31 | class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries |
|
32 | 32 | { |
|
33 | 33 | Q_OBJECT |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
|
34 | Q_PROPERTY(DeclarativeXyModel *model READ declarativeModel WRITE setDeclarativeModel) | |
|
35 | 35 | |
|
36 | 36 | public: |
|
37 | 37 | explicit DeclarativeScatterSeries(QObject *parent = 0); |
|
38 | ||
|
39 | public: | |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
|
41 | 38 | }; |
|
42 | 39 | |
|
43 | 40 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -29,11 +29,6 DeclarativeSplineSeries::DeclarativeSplineSeries(QObject *parent) : | |||
|
29 | 29 | { |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | QDeclarativeListProperty<DeclarativeXyPoint> DeclarativeSplineSeries::points() | |
|
33 | { | |
|
34 | return QDeclarativeListProperty<DeclarativeXyPoint>(this, 0, &DeclarativeXySeries::appendPoints); | |
|
35 | } | |
|
36 | ||
|
37 | 32 | #include "moc_declarativesplineseries.cpp" |
|
38 | 33 | |
|
39 | 34 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -31,13 +31,10 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
31 | 31 | class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries |
|
32 | 32 | { |
|
33 | 33 | Q_OBJECT |
|
34 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeXyPoint> points READ points) | |
|
34 | Q_PROPERTY(DeclarativeXyModel *model READ declarativeModel WRITE setDeclarativeModel) | |
|
35 | 35 | |
|
36 | 36 | public: |
|
37 | 37 | explicit DeclarativeSplineSeries(QObject *parent = 0); |
|
38 | ||
|
39 | public: | |
|
40 | QDeclarativeListProperty<DeclarativeXyPoint> points(); | |
|
41 | 38 | }; |
|
42 | 39 | |
|
43 | 40 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -33,12 +33,27 DeclarativeXySeries::~DeclarativeXySeries() | |||
|
33 | 33 | { |
|
34 | 34 | } |
|
35 | 35 | |
|
36 |
|
|
|
37 | DeclarativeXyPoint *element) | |
|
36 | bool DeclarativeXySeries::setDeclarativeModel(DeclarativeXyModel *model) | |
|
38 | 37 | { |
|
39 | QXYSeries *series = qobject_cast<QXYSeries *>(list->object); | |
|
40 | if (series) | |
|
41 | series->append(element->x(), element->y()); | |
|
38 | QAbstractItemModel *m = qobject_cast<QAbstractItemModel *>(model); | |
|
39 | bool value(false); | |
|
40 | if (m) { | |
|
41 | // All the inherited objects must be of type QXYSeries, so it is safe to cast | |
|
42 | QXYSeries *series = reinterpret_cast<QXYSeries *>(this); | |
|
43 | series->setModel(m); | |
|
44 | series->setModelMapping(0, 1, Qt::Vertical); | |
|
45 | } else { | |
|
46 | qWarning("DeclarativeXySeries: Illegal model"); | |
|
47 | } | |
|
48 | return value; | |
|
49 | } | |
|
50 | ||
|
51 | DeclarativeXyModel *DeclarativeXySeries::declarativeModel() | |
|
52 | { | |
|
53 | // All the inherited objects must be of type QXYSeries, so it is safe to cast | |
|
54 | QXYSeries *series = reinterpret_cast<QXYSeries *>(this); | |
|
55 | Q_ASSERT(series); | |
|
56 | return qobject_cast<DeclarativeXyModel *>(series->model()); | |
|
42 | 57 | } |
|
43 | 58 | |
|
44 | 59 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -23,7 +23,7 | |||
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | 25 | #include "declarativexypoint.h" |
|
26 |
#include |
|
|
26 | #include "declarativemodel.h" | |
|
27 | 27 | |
|
28 | 28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 29 | |
@@ -39,11 +39,8 public: | |||
|
39 | 39 | ~DeclarativeXySeries(); |
|
40 | 40 | |
|
41 | 41 | public: |
|
42 | virtual QDeclarativeListProperty<DeclarativeXyPoint> points() = 0; | |
|
43 | ||
|
44 | public Q_SLOTS: | |
|
45 | static void appendPoints(QDeclarativeListProperty<DeclarativeXyPoint> *list, | |
|
46 | DeclarativeXyPoint *element); | |
|
42 | bool setDeclarativeModel(DeclarativeXyModel *model); | |
|
43 | DeclarativeXyModel *declarativeModel(); | |
|
47 | 44 | }; |
|
48 | 45 | |
|
49 | 46 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -21,8 +21,8 | |||
|
21 | 21 | #include <QtDeclarative/qdeclarativeextensionplugin.h> |
|
22 | 22 | #include <QtDeclarative/qdeclarative.h> |
|
23 | 23 | #include "qchart.h" |
|
24 | #include "qaxiscategories.h" | |
|
24 | 25 | #include "declarativechart.h" |
|
25 | #include "declarativeaxis.h" | |
|
26 | 26 | #include "declarativexypoint.h" |
|
27 | 27 | #include "declarativelineseries.h" |
|
28 | 28 | #include "declarativesplineseries.h" |
@@ -30,7 +30,7 | |||
|
30 | 30 | #include "declarativescatterseries.h" |
|
31 | 31 | #include "declarativebarseries.h" |
|
32 | 32 | #include "declarativepieseries.h" |
|
33 | #include "declarativepiemodel.h" | |
|
33 | //#include "declarativepiemodel.h" | |
|
34 | 34 | |
|
35 | 35 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
36 | 36 | |
@@ -43,7 +43,9 public: | |||
|
43 | 43 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
44 | 44 | |
|
45 | 45 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
46 |
qmlRegisterType< |
|
|
46 | qmlRegisterUncreatableType<QAxis>(uri, 1, 0, "Axis", | |
|
47 | QLatin1String("Trying to create uncreatable type: Axis.")); | |
|
48 | //qmlRegisterType<DeclarativeAxisCategory>(uri, 1, 0, "AxisCategory"); | |
|
47 | 49 | qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint"); |
|
48 | 50 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
49 | 51 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
@@ -54,6 +56,7 public: | |||
|
54 | 56 | qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); |
|
55 | 57 | // TODO: a declarative model for each type |
|
56 | 58 | qmlRegisterType<DeclarativePieModel>(uri, 1, 0, "PieModel"); |
|
59 | qmlRegisterType<DeclarativeXyModel>(uri, 1, 0, "XYModel"); | |
|
57 | 60 | } |
|
58 | 61 | }; |
|
59 | 62 |
@@ -21,7 +21,6 RCC_DIR = $$CHART_BUILD_DIR/plugin | |||
|
21 | 21 | SOURCES += \ |
|
22 | 22 | plugin.cpp \ |
|
23 | 23 | declarativechart.cpp \ |
|
24 | declarativeaxis.cpp \ | |
|
25 | 24 | declarativexypoint.cpp \ |
|
26 | 25 | declarativexyseries.cpp \ |
|
27 | 26 | declarativelineseries.cpp \ |
@@ -30,10 +29,9 SOURCES += \ | |||
|
30 | 29 | declarativescatterseries.cpp \ |
|
31 | 30 | declarativepieseries.cpp \ |
|
32 | 31 | declarativebarseries.cpp \ |
|
33 |
declarative |
|
|
32 | declarativemodel.cpp | |
|
34 | 33 | HEADERS += \ |
|
35 | 34 | declarativechart.h \ |
|
36 | declarativeaxis.h \ | |
|
37 | 35 | declarativexypoint.h \ |
|
38 | 36 | declarativexyseries.h \ |
|
39 | 37 | declarativelineseries.h \ |
@@ -42,7 +40,7 HEADERS += \ | |||
|
42 | 40 | declarativescatterseries.h \ |
|
43 | 41 | declarativepieseries.h \ |
|
44 | 42 | declarativebarseries.h \ |
|
45 |
declarative |
|
|
43 | declarativemodel.h | |
|
46 | 44 | |
|
47 | 45 | TARGETPATH = QtCommercial/Chart |
|
48 | 46 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
@@ -34,6 +34,8 class QTCOMMERCIALCHART_EXPORT QAxis : public QObject | |||
|
34 | 34 | { |
|
35 | 35 | Q_OBJECT |
|
36 | 36 | Q_PROPERTY(bool labelsVisible READ labelsVisible WRITE setLabelsVisible) |
|
37 | Q_PROPERTY(qreal min READ min WRITE setMin) | |
|
38 | Q_PROPERTY(qreal max READ max WRITE setMax) | |
|
37 | 39 | |
|
38 | 40 | public: |
|
39 | 41 |
@@ -25,9 +25,9 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
25 | 25 | |
|
26 | 26 | Domain::Domain(QObject* parent):QObject(parent), |
|
27 | 27 | m_minX(0), |
|
28 |
m_maxX( |
|
|
28 | m_maxX(1), | |
|
29 | 29 | m_minY(0), |
|
30 |
m_maxY( |
|
|
30 | m_maxY(1), | |
|
31 | 31 | m_tickXCount(5), |
|
32 | 32 | m_tickYCount(5), |
|
33 | 33 | m_niceXNumbers(false), |
@@ -419,24 +419,36 void QXYSeriesPrivate::scaleDomain(Domain& domain) | |||
|
419 | 419 | |
|
420 | 420 | const QList<QPointF>& points = q->points(); |
|
421 | 421 | |
|
422 | if(points.isEmpty()){ | |
|
423 | minX=0.0; | |
|
424 | minY=0.0; | |
|
425 | maxX=1.0; | |
|
426 | maxY=1.0; | |
|
427 | } | |
|
422 | // if(points.isEmpty()){ | |
|
423 | // minX=0.0; | |
|
424 | // minY=0.0; | |
|
425 | // maxX=1.0; | |
|
426 | // maxY=1.0; | |
|
427 | // } | |
|
428 | 428 | |
|
429 | for (int i = 0; i < points.count(); i++) | |
|
430 | { | |
|
431 | qreal x = points[i].x(); | |
|
432 | qreal y = points[i].y(); | |
|
433 | minX = qMin(minX, x); | |
|
434 | minY = qMin(minY, y); | |
|
435 | maxX = qMax(maxX, x); | |
|
436 | maxY = qMax(maxY, y); | |
|
437 | } | |
|
429 | // for (int i = 0; i < points.count(); i++) | |
|
430 | // { | |
|
431 | // qreal x = points[i].x(); | |
|
432 | // qreal y = points[i].y(); | |
|
433 | // minX = qMin(minX, x); | |
|
434 | // minY = qMin(minY, y); | |
|
435 | // maxX = qMax(maxX, x); | |
|
436 | // maxY = qMax(maxY, y); | |
|
437 | // } | |
|
438 | 438 | |
|
439 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
|
439 | // domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
|
440 | ||
|
441 | if (!points.isEmpty()) { | |
|
442 | for (int i = 0; i < points.count(); i++) { | |
|
443 | qreal x = points[i].x(); | |
|
444 | qreal y = points[i].y(); | |
|
445 | minX = qMin(minX, x); | |
|
446 | minY = qMin(minY, y); | |
|
447 | maxX = qMax(maxX, x); | |
|
448 | maxY = qMax(maxY, y); | |
|
449 | } | |
|
450 | domain.setRange(minX,maxX,minY,maxY,tickXCount,tickYCount); | |
|
451 | } | |
|
440 | 452 | } |
|
441 | 453 | |
|
442 | 454 | QList<LegendMarker*> QXYSeriesPrivate::createLegendMarker(QLegend* legend) |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now