@@ -180,7 +180,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
180 | When \c{true}, all generated numbers appearing in various series and axis labels will be |
|
180 | When \c{true}, all generated numbers appearing in various series and axis labels will be | |
181 | localized using the default QLocale of the application, which defaults to the system locale. |
|
181 | localized using the default QLocale of the application, which defaults to the system locale. | |
182 | When \c{false}, the "C" locale is always used. |
|
182 | When \c{false}, the "C" locale is always used. | |
183 |
Defaults to \c{ |
|
183 | Defaults to \c{false}. | |
|
184 | ||||
|
185 | \sa locale | |||
|
186 | */ | |||
|
187 | ||||
|
188 | /*! | |||
|
189 | \qmlproperty locale ChartView::locale | |||
|
190 | \since QtCharts 2.0 | |||
|
191 | Sets the locale used to format various chart labels when localizeNumbers is \c{true}. | |||
|
192 | This also determines the locale used to format DateTimeAxis labels regardless of | |||
|
193 | localizeNumbers property. | |||
|
194 | Defaults to application default locale at the time the chart is constructed. | |||
|
195 | ||||
|
196 | \sa localizeNumbers | |||
184 | */ |
|
197 | */ | |
185 |
|
198 | |||
186 | /*! |
|
199 | /*! | |
@@ -732,6 +745,19 bool DeclarativeChart::localizeNumbers() const | |||||
732 | return m_chart->localizeNumbers(); |
|
745 | return m_chart->localizeNumbers(); | |
733 | } |
|
746 | } | |
734 |
|
747 | |||
|
748 | void QtCommercialChart::DeclarativeChart::setLocale(const QLocale &locale) | |||
|
749 | { | |||
|
750 | if (m_chart->locale() != locale) { | |||
|
751 | m_chart->setLocale(locale); | |||
|
752 | emit localeChanged(); | |||
|
753 | } | |||
|
754 | } | |||
|
755 | ||||
|
756 | QLocale QtCommercialChart::DeclarativeChart::locale() const | |||
|
757 | { | |||
|
758 | return m_chart->locale(); | |||
|
759 | } | |||
|
760 | ||||
735 | int DeclarativeChart::count() |
|
761 | int DeclarativeChart::count() | |
736 | { |
|
762 | { | |
737 | return m_chart->series().count(); |
|
763 | return m_chart->series().count(); |
@@ -34,6 +34,7 | |||||
34 | #endif |
|
34 | #endif | |
35 |
|
35 | |||
36 | #include "qchart.h" |
|
36 | #include "qchart.h" | |
|
37 | #include <QtCore/QLocale> | |||
37 |
|
38 | |||
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
39 |
|
40 | |||
@@ -68,6 +69,7 class DeclarativeChart : public QDECLARATIVE_PAINTED_ITEM | |||||
68 | Q_PROPERTY(QDeclarativeListProperty<QAbstractAxis> axes READ axes REVISION 2) |
|
69 | Q_PROPERTY(QDeclarativeListProperty<QAbstractAxis> axes READ axes REVISION 2) | |
69 | #endif |
|
70 | #endif | |
70 | Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers NOTIFY localizeNumbersChanged REVISION 4) |
|
71 | Q_PROPERTY(bool localizeNumbers READ localizeNumbers WRITE setLocalizeNumbers NOTIFY localizeNumbersChanged REVISION 4) | |
|
72 | Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged REVISION 4) | |||
71 | Q_ENUMS(Animation) |
|
73 | Q_ENUMS(Animation) | |
72 | Q_ENUMS(Theme) |
|
74 | Q_ENUMS(Theme) | |
73 | Q_ENUMS(SeriesType) |
|
75 | Q_ENUMS(SeriesType) | |
@@ -145,6 +147,8 public: | |||||
145 | Q_REVISION(3) QColor plotAreaColor(); |
|
147 | Q_REVISION(3) QColor plotAreaColor(); | |
146 | Q_REVISION(4) void setLocalizeNumbers(bool localize); |
|
148 | Q_REVISION(4) void setLocalizeNumbers(bool localize); | |
147 | Q_REVISION(4) bool localizeNumbers() const; |
|
149 | Q_REVISION(4) bool localizeNumbers() const; | |
|
150 | Q_REVISION(4) void setLocale(const QLocale &locale); | |||
|
151 | Q_REVISION(4) QLocale locale() const; | |||
148 |
|
152 | |||
149 | int count(); |
|
153 | int count(); | |
150 | void setDropShadowEnabled(bool enabled); |
|
154 | void setDropShadowEnabled(bool enabled); | |
@@ -201,6 +205,7 Q_SIGNALS: | |||||
201 | Q_REVISION(3) void plotAreaColorChanged(); |
|
205 | Q_REVISION(3) void plotAreaColorChanged(); | |
202 | Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter); |
|
206 | Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter); | |
203 | Q_REVISION(4) void localizeNumbersChanged(); |
|
207 | Q_REVISION(4) void localizeNumbersChanged(); | |
|
208 | Q_REVISION(4) void localeChanged(); | |||
204 |
|
209 | |||
205 | private Q_SLOTS: |
|
210 | private Q_SLOTS: | |
206 | void changeMinimumMargins(int top, int bottom, int left, int right); |
|
211 | void changeMinimumMargins(int top, int bottom, int left, int right); |
@@ -258,7 +258,66 public: | |||||
258 | qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper"); |
|
258 | qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper"); | |
259 | qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper", |
|
259 | qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper", | |
260 | QLatin1String("Trying to create uncreatable: BoxPlotModelMapper.")); |
|
260 | QLatin1String("Trying to create uncreatable: BoxPlotModelMapper.")); | |
|
261 | ||||
|
262 | // Re-register latest revisions for 2.0 | |||
261 | qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView"); |
|
263 | qmlRegisterType<DeclarativeChart, 4>(uri, 2, 0, "ChartView"); | |
|
264 | qmlRegisterType<DeclarativeLineSeries, 3>(uri, 2, 0, "LineSeries"); | |||
|
265 | qmlRegisterType<DeclarativeScatterSeries, 4>(uri, 2, 0, "ScatterSeries"); | |||
|
266 | qmlRegisterType<DeclarativeSplineSeries, 3>(uri, 2, 0, "SplineSeries"); | |||
|
267 | qmlRegisterType<DeclarativeAreaSeries, 4>(uri, 2, 0, "AreaSeries"); | |||
|
268 | qmlRegisterType<DeclarativeBarSeries, 2>(uri, 2, 0, "BarSeries"); | |||
|
269 | qmlRegisterType<DeclarativeStackedBarSeries, 2>(uri, 2, 0, "StackedBarSeries"); | |||
|
270 | qmlRegisterType<DeclarativePercentBarSeries, 2>(uri, 2, 0, "PercentBarSeries"); | |||
|
271 | qmlRegisterType<DeclarativeHorizontalBarSeries, 2>(uri, 2, 0, "HorizontalBarSeries"); | |||
|
272 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 2>(uri, 2, 0, "HorizontalStackedBarSeries"); | |||
|
273 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 2>(uri, 2, 0, "HorizontalPercentBarSeries"); | |||
|
274 | qmlRegisterType<DeclarativeBarSet, 2>(uri, 2, 0, "BarSet"); | |||
|
275 | qmlRegisterType<DeclarativeBoxPlotSeries, 1>(uri, 2, 0, "BoxPlotSeries"); | |||
|
276 | qmlRegisterType<DeclarativeBoxSet, 1>(uri, 2, 0, "BoxSet"); | |||
|
277 | qmlRegisterType<DeclarativePieSlice>(uri, 2, 0, "PieSlice"); | |||
|
278 | qmlRegisterType<DeclarativePieSeries>(uri, 2, 0, "PieSeries"); | |||
|
279 | qmlRegisterType<DeclarativeXYPoint>(uri, 2, 0, "XYPoint"); | |||
|
280 | qmlRegisterType<QHXYModelMapper>(uri, 2, 0, "HXYModelMapper"); | |||
|
281 | qmlRegisterType<QVXYModelMapper>(uri, 2, 0, "VXYModelMapper"); | |||
|
282 | qmlRegisterType<QHPieModelMapper>(uri, 2, 0, "HPieModelMapper"); | |||
|
283 | qmlRegisterType<QVPieModelMapper>(uri, 2, 0, "VPieModelMapper"); | |||
|
284 | qmlRegisterType<QHBarModelMapper>(uri, 2, 0, "HBarModelMapper"); | |||
|
285 | qmlRegisterType<QVBarModelMapper>(uri, 2, 0, "VBarModelMapper"); | |||
|
286 | qmlRegisterType<QValueAxis>(uri, 2, 0, "ValueAxis"); | |||
|
287 | #ifndef QT_ON_ARM | |||
|
288 | qmlRegisterType<QDateTimeAxis>(uri, 2, 0, "DateTimeAxis"); | |||
|
289 | #endif | |||
|
290 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 2, 0, "CategoryAxis"); | |||
|
291 | qmlRegisterType<DeclarativeCategoryRange>(uri, 2, 0, "CategoryRange"); | |||
|
292 | qmlRegisterType<QBarCategoryAxis>(uri, 2, 0, "BarCategoryAxis"); | |||
|
293 | qmlRegisterUncreatableType<QLegend>(uri, 2, 0, "Legend", | |||
|
294 | QLatin1String("Trying to create uncreatable: Legend.")); | |||
|
295 | qmlRegisterUncreatableType<QXYSeries>(uri, 2, 0, "XYSeries", | |||
|
296 | QLatin1String("Trying to create uncreatable: XYSeries.")); | |||
|
297 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 2, 0, "AbstractItemModel", | |||
|
298 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); | |||
|
299 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 2, 0, "XYModelMapper", | |||
|
300 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); | |||
|
301 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 2, 0, "PieModelMapper", | |||
|
302 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | |||
|
303 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 2, 0, "BarModelMapper", | |||
|
304 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); | |||
|
305 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 2, 0, "AbstractSeries", | |||
|
306 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); | |||
|
307 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 2, 0, "AbstractBarSeries", | |||
|
308 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); | |||
|
309 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 2, 0, "AbstractAxis", | |||
|
310 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); | |||
|
311 | qmlRegisterUncreatableType<QBarSet>(uri, 2, 0, "BarSetBase", | |||
|
312 | QLatin1String("Trying to create uncreatable: BarsetBase.")); | |||
|
313 | qmlRegisterUncreatableType<QPieSeries>(uri, 2, 0, "QPieSeries", | |||
|
314 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); | |||
|
315 | qmlRegisterUncreatableType<DeclarativeAxes>(uri, 2, 0, "DeclarativeAxes", | |||
|
316 | QLatin1String("Trying to create uncreatable: DeclarativeAxes.")); | |||
|
317 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 2, 0, "Margins", | |||
|
318 | QLatin1String("Trying to create uncreatable: Margins.")); | |||
|
319 | qmlRegisterType<DeclarativePolarChart>(uri, 2, 0, "PolarChartView"); | |||
|
320 | qmlRegisterType<QLogValueAxis>(uri, 2, 0, "LogValueAxis"); | |||
262 | } |
|
321 | } | |
263 | }; |
|
322 | }; | |
264 |
|
323 |
@@ -29,7 +29,7 | |||||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
30 | |||
31 | static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.lhjztL]*([dicuoxfegXFEG])"; |
|
31 | static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.lhjztL]*([dicuoxfegXFEG])"; | |
32 |
static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\. |
|
32 | static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$"; | |
33 | static QRegExp *labelFormatMatcher = 0; |
|
33 | static QRegExp *labelFormatMatcher = 0; | |
34 | static QRegExp *labelFormatMatcherLocalized = 0; |
|
34 | static QRegExp *labelFormatMatcherLocalized = 0; | |
35 | class StaticLabelFormatMatcherDeleter |
|
35 | class StaticLabelFormatMatcherDeleter |
@@ -45,7 +45,7 ChartPresenter::ChartPresenter(QChart *chart, QChart::ChartType type) | |||||
45 | m_background(0), |
|
45 | m_background(0), | |
46 | m_plotAreaBackground(0), |
|
46 | m_plotAreaBackground(0), | |
47 | m_title(0), |
|
47 | m_title(0), | |
48 |
m_localizeNumbers( |
|
48 | m_localizeNumbers(false) | |
49 | { |
|
49 | { | |
50 | if (type == QChart::ChartTypeCartesian) |
|
50 | if (type == QChart::ChartTypeCartesian) | |
51 | m_layout = new CartesianChartLayout(this); |
|
51 | m_layout = new CartesianChartLayout(this); |
@@ -150,7 +150,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
150 | When \c{true}, all generated numbers appearing in various series and axis labels will be |
|
150 | When \c{true}, all generated numbers appearing in various series and axis labels will be | |
151 | localized using the QLocale set with the locale property. |
|
151 | localized using the QLocale set with the locale property. | |
152 | When \c{false}, the "C" locale is always used. |
|
152 | When \c{false}, the "C" locale is always used. | |
153 |
Defaults to \c{ |
|
153 | Defaults to \c{false}. | |
154 | \note This property doesn't affect QDateTimeAxis labels, which always use the QLocale set with |
|
154 | \note This property doesn't affect QDateTimeAxis labels, which always use the QLocale set with | |
155 | the locale property. |
|
155 | the locale property. | |
156 |
|
156 |
General Comments 0
You need to be logged in to leave comments.
Login now