diff --git a/demos/qmlchart/qml/qmlchart/View5.qml b/demos/qmlchart/qml/qmlchart/View5.qml index 5b7ba4d..d9f2d44 100644 --- a/demos/qmlchart/qml/qmlchart/View5.qml +++ b/demos/qmlchart/qml/qmlchart/View5.qml @@ -31,7 +31,6 @@ Rectangle { legend: ChartView.LegendBottom // TODO: labels defined by x-axis, not by bar series axisXLabels: ["0", "2008", "1", "2009", "2", "2010", "3", "2012"] - axisX.max: 10 GroupedBarSeries { barCategories: [ "2008", "2009", "2010", "2011", "2012" ] diff --git a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml index df25c30..50ac53c 100644 --- a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml +++ b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml @@ -43,10 +43,6 @@ Rectangle { LineSeries { name: "line" - // TODO: the current mapper api - model: chartModel - modelMapper.mapX: 3 - modelMapper.mapY: 3 // TODO: the new mapper api // XYModelMapperVertical { @@ -63,20 +59,12 @@ Rectangle { horizontalPosition: 0.2 verticalPosition: 0.3 -// model: chartModel -// // TODO: the current mapper api -// modelMapper.mapLabels: 1 -// modelMapper.mapValues: 2 -// modelMapper.first: 0 -// modelMapper.count: -1 // "Undefined" = -1 by default -// modelMapper.orientation: PieModelMapper.Vertical - - // TODO: the new mapper api -// PieModelMapperVertical { -// model: chartModel -// labelsColumn: 0 -// valuesColumn: 1 -// } + VPieModelMapper { + series: pieSeries // TODO + model: chartModel + labelsColumn: 1 + valuesColumn: 2 + } } // TODO: the new mapper api @@ -90,14 +78,14 @@ Rectangle { AreaSeries { name: "area" upperSeries: LineSeries { - model: chartModel - modelMapper.mapX: 2 - modelMapper.mapY: 2 +// model: chartModel +// modelMapper.mapX: 2 +// modelMapper.mapY: 2 } lowerSeries: LineSeries { - model: chartModel - modelMapper.mapX: 2 - modelMapper.mapY: 0 +// model: chartModel +// modelMapper.mapX: 2 +// modelMapper.mapY: 0 } } diff --git a/plugins/declarative/declarativemodel.h b/plugins/declarative/declarativemodel.h index 92a80a9..143a2bc 100644 --- a/plugins/declarative/declarativemodel.h +++ b/plugins/declarative/declarativemodel.h @@ -33,6 +33,9 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE +// TODO: move model into demo app, +// the ChartModel API will not be implemented by charts declarative plugin + class DeclarativeTableModelElement : public QObject { Q_OBJECT diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp index e1ad692..12ce09b 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -31,7 +31,8 @@ #include "declarativebarseries.h" #include "declarativepieseries.h" #include "declarativemodel.h" -#include +#include +#include #include QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -58,6 +59,12 @@ public: qmlRegisterType(uri, 1, 0, "ChartModelElement"); qmlRegisterType(uri, 1, 0, "BarSet"); + qmlRegisterUncreatableType(uri, 1, 0, "AbstractItemModel", + QLatin1String("Trying to create uncreatable: AbstractItemModel.")); + qmlRegisterUncreatableType(uri, 1, 0, "PieModelMapper", + QLatin1String("Trying to create uncreatable: PieModelMapper.")); + qmlRegisterType(uri, 1, 0, "HPieModelMapper"); + qmlRegisterType(uri, 1, 0, "VPieModelMapper"); qmlRegisterUncreatableType(uri, 1, 0, "AbstractSeries", QLatin1String("Trying to create uncreatable: AbstractSeries.")); diff --git a/src/piechart/qpiemodelmapper.cpp b/src/piechart/qpiemodelmapper.cpp index 553ab27..bcf5caa 100644 --- a/src/piechart/qpiemodelmapper.cpp +++ b/src/piechart/qpiemodelmapper.cpp @@ -140,17 +140,17 @@ void QPieModelMapper::reset() /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QPieModelMapperPrivate::QPieModelMapperPrivate(QPieModelMapper *q) : + m_series(0), + m_model(0), + m_first(0), + m_count(-1), + m_orientation(Qt::Vertical), + m_valuesIndex(-1), + m_labelsIndex(-1), + m_seriesSignalsBlock(false), + m_modelSignalsBlock(false), q_ptr(q) { - m_series = 0; - m_model = 0; - m_first = 0; - m_count = -1; - m_orientation = Qt::Vertical; - m_valuesIndex = -1; - m_labelsIndex = -1; - m_seriesSignalsBlock = false; - m_modelSignalsBlock = false; } void QPieModelMapperPrivate::blockModelSignals(bool block) diff --git a/src/piechart/qpiemodelmapper.h b/src/piechart/qpiemodelmapper.h index 5545c9a..ce0af45 100644 --- a/src/piechart/qpiemodelmapper.h +++ b/src/piechart/qpiemodelmapper.h @@ -34,6 +34,8 @@ class QPieSeries; class QTCOMMERCIALCHART_EXPORT QPieModelMapper : public QObject { Q_OBJECT + Q_PROPERTY(QPieSeries *series READ series WRITE setSeries) + Q_PROPERTY(QAbstractItemModel *model READ model WRITE setModel) Q_PROPERTY(int first READ first WRITE setFirst) Q_PROPERTY(int count READ count WRITE setCount) Q_ENUMS(Qt::Orientation) diff --git a/src/piechart/qpiemodelmapper_p.h b/src/piechart/qpiemodelmapper_p.h index c059df5..dce5323 100644 --- a/src/piechart/qpiemodelmapper_p.h +++ b/src/piechart/qpiemodelmapper_p.h @@ -47,8 +47,6 @@ private: void blockSeriesSignals(bool block = true); private: - bool m_seriesSignalsBlock; - bool m_modelSignalsBlock; QPieSeries *m_series; QList m_slices; QAbstractItemModel *m_model; @@ -57,6 +55,8 @@ private: Qt::Orientation m_orientation; int m_valuesIndex; int m_labelsIndex; + bool m_seriesSignalsBlock; + bool m_modelSignalsBlock; private: