diff --git a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml index 7609ca8..7306a6e 100644 --- a/demos/qmlcustommodel/qml/qmlcustommodel/main.qml +++ b/demos/qmlcustommodel/qml/qmlcustommodel/main.qml @@ -58,20 +58,14 @@ Rectangle { size: 0.4 horizontalPosition: 0.2 verticalPosition: 0.3 - - VPieModelMapper { - model: chartModel - labelsColumn: 0 - valuesColumn: 1 - } } -// VPieModelMapper { -// series: pieSeries -// model: chartModel -// labelsColumn: 1 -// valuesColumn: 2 -// } + VPieModelMapper { + series: pieSeries + model: chartModel + labelsColumn: 0 + valuesColumn: 1 + } // AreaSeries { // name: "area" diff --git a/plugins/declarative/plugin.cpp b/plugins/declarative/plugin.cpp index fb542ee..a64d25a 100644 --- a/plugins/declarative/plugin.cpp +++ b/plugins/declarative/plugin.cpp @@ -59,6 +59,8 @@ public: qmlRegisterType(uri, 1, 0, "ChartModelElement"); qmlRegisterType(uri, 1, 0, "BarSet"); + qmlRegisterUncreatableType(uri, 1, 0, "QPieSeries", + QLatin1String("Trying to create uncreatable: QPieSeries.")); qmlRegisterUncreatableType(uri, 1, 0, "AbstractItemModel", QLatin1String("Trying to create uncreatable: AbstractItemModel.")); qmlRegisterUncreatableType(uri, 1, 0, "PieModelMapper", diff --git a/src/charttablemodel.cpp b/src/charttablemodel.cpp index 26193b1..258ac18 100644 --- a/src/charttablemodel.cpp +++ b/src/charttablemodel.cpp @@ -20,31 +20,16 @@ #include "charttablemodel.h" #include -#include #include #include QTCOMMERCIALCHART_USE_NAMESPACE ChartTableModel::ChartTableModel(QObject *parent) : - QAbstractTableModel(parent) + QAbstractTableModel(parent), + m_columnCount(0), + m_rowCount(0) { - qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); - - m_columnCount = 2; - m_rowCount = 0; - - // m_data - for (int i = 0; i < m_rowCount; i++) { - QVector* dataVec = new QVector(m_columnCount); - for (int k = 0; k < dataVec->size(); k++) { - if (k%2 == 0) - dataVec->replace(k, i * 50 + qrand()%20); - else - dataVec->replace(k, qrand()%100); - } - m_data.append(dataVec); - } } int ChartTableModel::rowCount(const QModelIndex & parent) const