##// END OF EJS Templates
Misc fixes...
Miikka Heikkinen -
r2710:e26d82d56bc9
parent child
Show More
@@ -180,7 +180,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE
180 180 When \c{true}, all generated numbers appearing in various series and axis labels will be
181 181 localized using the default QLocale of the application, which defaults to the system locale.
182 182 When \c{false}, the "C" locale is always used.
183 Defaults to \c{true}.
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 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 761 int DeclarativeChart::count()
736 762 {
737 763 return m_chart->series().count();
@@ -34,6 +34,7
34 34 #endif
35 35
36 36 #include "qchart.h"
37 #include <QtCore/QLocale>
37 38
38 39 QTCOMMERCIALCHART_BEGIN_NAMESPACE
39 40
@@ -68,6 +69,7 class DeclarativeChart : public QDECLARATIVE_PAINTED_ITEM
68 69 Q_PROPERTY(QDeclarativeListProperty<QAbstractAxis> axes READ axes REVISION 2)
69 70 #endif
70 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 73 Q_ENUMS(Animation)
72 74 Q_ENUMS(Theme)
73 75 Q_ENUMS(SeriesType)
@@ -145,6 +147,8 public:
145 147 Q_REVISION(3) QColor plotAreaColor();
146 148 Q_REVISION(4) void setLocalizeNumbers(bool localize);
147 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 153 int count();
150 154 void setDropShadowEnabled(bool enabled);
@@ -201,6 +205,7 Q_SIGNALS:
201 205 Q_REVISION(3) void plotAreaColorChanged();
202 206 Q_REVISION(3) void backgroundRoundnessChanged(qreal diameter);
203 207 Q_REVISION(4) void localizeNumbersChanged();
208 Q_REVISION(4) void localeChanged();
204 209
205 210 private Q_SLOTS:
206 211 void changeMinimumMargins(int top, int bottom, int left, int right);
@@ -258,7 +258,66 public:
258 258 qmlRegisterType<QVBoxPlotModelMapper>(uri, 2, 0, "VBoxPlotModelMapper");
259 259 qmlRegisterUncreatableType<QBoxPlotModelMapper>(uri, 2, 0, "BoxPlotModelMapper",
260 260 QLatin1String("Trying to create uncreatable: BoxPlotModelMapper."));
261
262 // Re-register latest revisions for 2.0
261 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 29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 31 static const char *labelFormatMatchString = "%[\\-\\+#\\s\\d\\.lhjztL]*([dicuoxfegXFEG])";
32 static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.?(\\d)*([defgiEG])(.*)$";
32 static const char *labelFormatMatchLocalizedString = "^([^%]*)%\\.(\\d+)([defgiEG])(.*)$";
33 33 static QRegExp *labelFormatMatcher = 0;
34 34 static QRegExp *labelFormatMatcherLocalized = 0;
35 35 class StaticLabelFormatMatcherDeleter
@@ -45,7 +45,7 ChartPresenter::ChartPresenter(QChart *chart, QChart::ChartType type)
45 45 m_background(0),
46 46 m_plotAreaBackground(0),
47 47 m_title(0),
48 m_localizeNumbers(true)
48 m_localizeNumbers(false)
49 49 {
50 50 if (type == QChart::ChartTypeCartesian)
51 51 m_layout = new CartesianChartLayout(this);
@@ -150,7 +150,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
150 150 When \c{true}, all generated numbers appearing in various series and axis labels will be
151 151 localized using the QLocale set with the locale property.
152 152 When \c{false}, the "C" locale is always used.
153 Defaults to \c{true}.
153 Defaults to \c{false}.
154 154 \note This property doesn't affect QDateTimeAxis labels, which always use the QLocale set with
155 155 the locale property.
156 156
General Comments 0
You need to be logged in to leave comments. Login now