##// END OF EJS Templates
Draft version for QML PieSeries model API
Tero Ahola -
r1130:2b935e4f3207
parent child
Show More
@@ -0,0 +1,89
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 #include "DeclarativePieModel.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
24 #include <qdeclarativelist.h>
25
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
28 DeclarativePieModel::DeclarativePieModel(QObject *parent) :
29 ChartTableModel(parent)
30 {
31 }
32
33 //void DeclarativePieModel::classBegin()
34 //{
35 //}
36
37 //void DeclarativePieModel::componentComplete()
38 //{
39 //}
40
41 void DeclarativePieModel::append(QPieSlice* slice)
42 {
43 // TODO: label not working...
44 qDebug() << "DeclarativePieModel::append:" << slice->label() << " " << slice->value();
45 qDebug() << "rowCount:" << rowCount();
46 qDebug() << "coolCount:" << columnCount();
47 insertRow(rowCount());
48 qDebug() << "new rowCount:" << rowCount();
49
50 qDebug() << setData(createIndex(rowCount() - 1, 0), slice->value());
51 qDebug() << setData(createIndex(rowCount() - 1, 1), slice->label());
52 }
53
54 void DeclarativePieModel::append(QVariantList slices)
55 {
56 qDebug() << "append:" << slices;
57 QString label = "";
58 for (int i(0); i < slices.count(); i++) {
59 if (i % 2) {
60 bool ok(false);
61 qreal value = slices.at(i).toReal(&ok);
62 if (ok) {
63 QPieSlice *slice = new QPieSlice(value, label);
64 append(slice);
65 }
66 } else {
67 label = slices.at(i).toString();
68 }
69 }
70 }
71
72 QDeclarativeListProperty<QPieSlice> DeclarativePieModel::slices()
73 {
74 return QDeclarativeListProperty<QPieSlice>(this, 0, &DeclarativePieModel::appendSlice);
75 }
76
77 void DeclarativePieModel::appendSlice(QDeclarativeListProperty<QPieSlice> *list,
78 QPieSlice *slice)
79 {
80 DeclarativePieModel *pieModel = qobject_cast<DeclarativePieModel *>(list->object);
81 if (pieModel)
82 pieModel->append(slice);
83 else
84 qWarning() << "Illegal slice item";
85 }
86
87 #include "moc_declarativepiemodel.cpp"
88
89 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,61
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 #ifndef DECLARATIVEPIEMODEL_H
22 #define DECLARATIVEPIEMODEL_H
23
24 #include "qchartglobal.h"
25 #include "qpieslice.h"
26 #include "qpieseries.h"
27 #include "../src/charttablemodel.h"
28 #include <QDeclarativeParserStatus>
29 #include <QDeclarativeListProperty>
30 #include <QAbstractItemModel>
31 #include <QVariant>
32
33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34
35 class DeclarativePieModel : public ChartTableModel/*, public QDeclarativeParserStatus*/
36 {
37 // Q_INTERFACES(QDeclarativeParserStatus)
38 Q_OBJECT
39 Q_PROPERTY(QDeclarativeListProperty<QPieSlice> slices READ slices)
40 Q_CLASSINFO("DefaultProperty", "slices")
41
42 public:
43 explicit DeclarativePieModel(QObject *parent = 0);
44 QDeclarativeListProperty<QPieSlice> slices();
45
46 //public: // from QDeclarativeParserStatus
47 // virtual void classBegin();
48 // virtual void componentComplete();
49
50 public Q_SLOTS:
51 void append(QPieSlice* slice);
52 void append(QVariantList slices);
53 static void appendSlice(QDeclarativeListProperty<QPieSlice> *list,
54 QPieSlice *element);
55
56 public:
57 };
58
59 QTCOMMERCIALCHART_END_NAMESPACE
60
61 #endif // DECLARATIVEPIEMODEL_H
@@ -0,0 +1,141
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 #include "charttablemodel.h"
22 #include <QVector>
23 #include <QTime>
24 #include <QRect>
25 #include <QColor>
26
27 QTCOMMERCIALCHART_USE_NAMESPACE
28
29 ChartTableModel::ChartTableModel(QObject *parent) :
30 QAbstractTableModel(parent)
31 {
32 qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
33
34 m_columnCount = 2;
35 m_rowCount = 0;
36
37 // m_data
38 for (int i = 0; i < m_rowCount; i++) {
39 QVector<QVariant>* dataVec = new QVector<QVariant>(m_columnCount);
40 for (int k = 0; k < dataVec->size(); k++) {
41 if (k%2 == 0)
42 dataVec->replace(k, i * 50 + qrand()%20);
43 else
44 dataVec->replace(k, qrand()%100);
45 }
46 m_data.append(dataVec);
47 }
48 }
49
50 int ChartTableModel::rowCount(const QModelIndex & parent) const
51 {
52 Q_UNUSED(parent)
53 return m_data.count();
54 }
55
56 int ChartTableModel::columnCount(const QModelIndex & parent) const
57 {
58 Q_UNUSED(parent)
59 return m_columnCount;
60 }
61
62 QVariant ChartTableModel::headerData (int section, Qt::Orientation orientation, int role ) const
63 {
64 if (role != Qt::DisplayRole)
65 return QVariant();
66
67 if (orientation == Qt::Horizontal)
68 {
69 if (section%2 == 0)
70 return "x";
71 else
72 return "y";
73 }
74 else
75 return QString("%1").arg(section + 1);
76 }
77
78 QVariant ChartTableModel::data(const QModelIndex &index, int role) const
79 {
80 if (role == Qt::DisplayRole) {
81 return m_data[index.row()]->at(index.column());
82 } else if (role == Qt::EditRole) {
83 return m_data[index.row()]->at(index.column());
84 }
85 return QVariant();
86 }
87
88 bool ChartTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
89 {
90 if (index.isValid() && role == Qt::EditRole) {
91 m_data[index.row()]->replace(index.column(), value);
92 emit dataChanged(index, index);
93 return true;
94 }
95 return false;
96 }
97
98 void ChartTableModel::insertRow(int row, const QModelIndex &parent)
99 {
100 Q_UNUSED(parent)
101
102 beginInsertRows(QModelIndex(), row, row);
103 QVector<QVariant>* dataVec = new QVector<QVariant>(m_columnCount);
104 m_data.insert(row, dataVec);
105 endInsertRows();
106 }
107
108 //bool ChartTableModel::removeRow(int row, const QModelIndex &parent)
109 //{
110 // Q_UNUSED(parent)
111 // Q_ASSERT(row >= 0 && row < rowCount);
112
113 // beginRemoveRows(parent, row, row);
114 // m_data.removeAt(row);
115 // endRemoveRows();
116 // return true;
117 //}
118
119 bool ChartTableModel::removeRow(int row, const QModelIndex &parent)
120 {
121 return QAbstractTableModel::removeRow(row, parent);
122 }
123
124 bool ChartTableModel::removeRows(int row, int count, const QModelIndex &parent)
125 {
126 beginRemoveRows(parent, row, row + count - 1);
127 bool removed(false);
128 for (int i(row); i < (row + count); i++) {
129 m_data.removeAt(i);
130 removed = true;
131 }
132 endRemoveRows();
133 return removed;
134 }
135
136 Qt::ItemFlags ChartTableModel::flags ( const QModelIndex & index ) const
137 {
138 return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
139 }
140
141 #include "moc_charttablemodel.cpp"
@@ -0,0 +1,58
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 #ifndef CHARTTABLEMODEL_H
22 #define CHARTTABLEMODEL_H
23
24 #include "qchartglobal.h"
25 #include <QAbstractTableModel>
26 #include <QHash>
27 #include <QRect>
28
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
31 class QTCOMMERCIALCHART_EXPORT ChartTableModel : public QAbstractTableModel
32 {
33 Q_OBJECT
34 Q_PROPERTY(int count READ rowCount)
35
36 public:
37 explicit ChartTableModel(QObject *parent = 0);
38
39 int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
40 int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
41 QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
42 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
43 bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
44 Qt::ItemFlags flags ( const QModelIndex & index ) const;
45 void insertRow(int row, const QModelIndex &parent = QModelIndex());
46 /*Q_INVOKABLE*/ //bool removeRow(int row, const QModelIndex &parent = QModelIndex());
47 Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex());
48 Q_INVOKABLE bool removeRow (int row, const QModelIndex &parent = QModelIndex());
49
50 private:
51 QList<QVector<QVariant> * > m_data;
52 int m_columnCount;
53 int m_rowCount;
54 };
55
56 QTCOMMERCIALCHART_END_NAMESPACE
57
58 #endif // CHARTTABLEMODEL_H
@@ -24,24 +24,88 import QtCommercial.Chart 1.0
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26
26
27 Chart {
27 ChartView {
28 id: chart
28 title: "Car brand shares in Finland"
29 title: "Car brand shares in Finland"
29 anchors.fill: parent
30 anchors.top: parent.top
30 theme: Chart.ChartThemeLight
31 anchors.bottom: button.top
31 legend: Chart.LegendBottom
32 anchors.left: parent.left
33 anchors.right: parent.right
34 theme: ChartView.ChartThemeLight
35 legend: ChartView.LegendBottom
36 animationOptions: ChartView.SeriesAnimations
32
37
33 PieSeries {
38 PieSeries {
34 horizontalPosition: 0.5
39 model: PieModel {
35 verticalPosition: 0.5
40 id: pieModel
36 size: 0.7
41 PieSlice { label: "Volkswagen"; value: 13.5 }
37 slices: [
42 PieSlice { label: "Toyota"; value: 10.9 }
38 PieSlice { label: "Volkswagen"; value: 13.5 },
43 PieSlice { label: "Ford"; value: 8.6 }
39 PieSlice { label: "Toyota"; value: 10.9 },
44 PieSlice { label: "Skoda"; value: 8.2 }
40 PieSlice { label: "Ford"; value: 8.6 },
45 PieSlice { label: "Volvo"; value: 6.8 }
41 PieSlice { label: "Skoda"; value: 8.2 },
46 }
42 PieSlice { label: "Volvo"; value: 6.8 },
47 }
43 PieSlice { label: "Others"; value: 52.0 }
48 }
44 ]
49
50 Rectangle {
51 id: button
52 anchors.bottom: parent.bottom
53 anchors.bottomMargin: 10
54 anchors.horizontalCenter: parent.horizontalCenter
55 height: 40
56 width: 100
57 color: "orange"
58 radius: 5
59 Text {
60 id: buttonText
61 anchors.centerIn: parent
62 text: button.state == "" ? "Show others" : "Hide others"
63 }
64 MouseArea {
65 anchors.fill: parent
66 onClicked: {
67 if (button.state == "") {
68 // The share of "others" was enabled -> append the data into the model
69 // TODO: this should also be doable by redefining the range inside the model
70 button.state = "show";
71 pieModel.append(["Others", 52.0]);
72 } else {
73 // The share of "others" was disabled -> remove the data from the model
74 // TODO: this should also be doable by redefining the range inside the model
75 button.state = "";
76 pieModel.removeRow(pieModel.count - 1);
45 }
77 }
46 }
78 }
47 }
79 }
80 }
81
82
83 // TODO: Optional syntax for defining models for different series. Is this really needed?
84 // ChartModel {
85 // id: chartModel
86 // ChartElement { column1: "Volkswagen"; column2: 13.5; column3: 1.2 }
87 // ChartElement { column1: "Toyota"; column2: 10.9; column3: 2.5 }
88 // }
89 // // column3 not used by pie series
90 // PieSeries {
91 // model: chartModel
92 // mappings: [ {"column1":"label"}, {"column2":"value"} ]
93 // }
94
95
96 // TODO: show how to use data from a list model in a chart view
97 // i.e. copy the data into a chart model
98 // ListModel {
99 // id: listModel
100 // ListElement {
101 // label: "Volkswagen"
102 // value: 13.5
103 // }
104 // ListElement {
105 // label: "Toyota"
106 // value: 10.9
107 // }
108 // // and so on...
109 // }
110
111 }
@@ -24,11 +24,11 import QtCommercial.Chart 1.0
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26
26
27 Chart {
27 ChartView {
28 title: "Line&Spline"
28 title: "Line&Spline"
29 anchors.fill: parent
29 anchors.fill: parent
30 theme: Chart.ChartThemeBrownSand
30 theme: ChartView.ChartThemeBrownSand
31 animationOptions: Chart.NoAnimation
31 animationOptions: ChartView.NoAnimation
32
32
33 LineSeries {
33 LineSeries {
34 name: "Line"
34 name: "Line"
@@ -24,11 +24,11 import QtCommercial.Chart 1.0
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26
26
27 Chart {
27 ChartView {
28 title: "NHL All-Star Team Players"
28 title: "NHL All-Star Team Players"
29 anchors.fill: parent
29 anchors.fill: parent
30 theme: Chart.ChartThemeHighContrast
30 theme: ChartView.ChartThemeHighContrast
31 legend: Chart.LegendTop
31 legend: ChartView.LegendTop
32
32
33 AreaSeries {
33 AreaSeries {
34 name: "Swedish"
34 name: "Swedish"
@@ -24,10 +24,10 import QtCommercial.Chart 1.0
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26
26
27 Chart {
27 ChartView {
28 title: "Scatters"
28 title: "Scatters"
29 anchors.fill: parent
29 anchors.fill: parent
30 theme: Chart.ChartThemeBlueCerulean
30 theme: ChartView.ChartThemeBlueCerulean
31
31
32 ScatterSeries {
32 ScatterSeries {
33 id: scatter1
33 id: scatter1
@@ -24,11 +24,11 import QtCommercial.Chart 1.0
24 Rectangle {
24 Rectangle {
25 anchors.fill: parent
25 anchors.fill: parent
26
26
27 Chart {
27 ChartView {
28 title: "Bar series"
28 title: "Bar series"
29 anchors.fill: parent
29 anchors.fill: parent
30 theme: Chart.ChartThemeLight
30 theme: ChartView.ChartThemeLight
31 legend: Chart.LegendBottom
31 legend: ChartView.LegendBottom
32
32
33 BarSeries {
33 BarSeries {
34 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
34 barCategories: [ "2008", "2009", "2010", "2011", "2012" ]
@@ -26,13 +26,9 Rectangle {
26 height: parent.height
26 height: parent.height
27 property int __viewNumber: 0
27 property int __viewNumber: 0
28
28
29 Timer {
29 MouseArea {
30 id: timer
30 anchors.fill: parent
31 running: true
31 onClicked: {
32 repeat: true
33 interval: 5000
34 triggeredOnStart: false
35 onTriggered: {
36 __viewNumber++;
32 __viewNumber++;
37 }
33 }
38 }
34 }
@@ -42,12 +38,4 Rectangle {
42 anchors.fill: parent
38 anchors.fill: parent
43 source: "View" + (__viewNumber % 5 + 1) + ".qml";
39 source: "View" + (__viewNumber % 5 + 1) + ".qml";
44 }
40 }
45
46 MouseArea {
47 anchors.fill: parent
48 onClicked: {
49 timer.restart();
50 __viewNumber++;
51 }
52 }
53 }
41 }
@@ -21,6 +21,7
21 #include "declarativepieseries.h"
21 #include "declarativepieseries.h"
22 #include "declarativechart.h"
22 #include "declarativechart.h"
23 #include "qchart.h"
23 #include "qchart.h"
24 #include <qdeclarativelist.h>
24
25
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26
27
@@ -29,17 +30,20 DeclarativePieSeries::DeclarativePieSeries(QObject *parent) :
29 {
30 {
30 }
31 }
31
32
32 QDeclarativeListProperty<QPieSlice> DeclarativePieSeries::slices()
33 bool DeclarativePieSeries::setPieModel(DeclarativePieModel *model)
33 {
34 {
34 return QDeclarativeListProperty<QPieSlice>(this, 0, &DeclarativePieSeries::appendSlice);
35 QAbstractItemModel *m = qobject_cast<QAbstractItemModel *>(model);
36 bool value(false);
37 if (m) {
38 value = QPieSeries::setModel(m);
39 setModelMapping(0, 1, Qt::Vertical);
40 }
41 return value;
35 }
42 }
36
43
37 void DeclarativePieSeries::appendSlice(QDeclarativeListProperty<QPieSlice> *list,
44 DeclarativePieModel *DeclarativePieSeries::pieModel()
38 QPieSlice *slice)
39 {
45 {
40 DeclarativePieSeries *series = qobject_cast<DeclarativePieSeries *>(list->object);
46 return qobject_cast<DeclarativePieModel *>(model());
41 if (series)
42 series->append(slice->value(), slice->label());
43 }
47 }
44
48
45 #include "moc_declarativepieseries.cpp"
49 #include "moc_declarativepieseries.cpp"
@@ -25,6 +25,9
25 #include "qpieslice.h"
25 #include "qpieslice.h"
26 #include "qpieseries.h"
26 #include "qpieseries.h"
27 #include <QDeclarativeListProperty>
27 #include <QDeclarativeListProperty>
28 #include <QAbstractItemModel>
29 #include <QVariant>
30 #include "declarativepiemodel.h"
28
31
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
32 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
33
@@ -33,15 +36,16 class QChart;
33 class DeclarativePieSeries : public QPieSeries
36 class DeclarativePieSeries : public QPieSeries
34 {
37 {
35 Q_OBJECT
38 Q_OBJECT
36 Q_PROPERTY(QDeclarativeListProperty<QPieSlice> slices READ slices)
39 Q_PROPERTY(DeclarativePieModel *model READ pieModel WRITE setPieModel)
37
40
38 public:
41 public:
39 explicit DeclarativePieSeries(QObject *parent = 0);
42 explicit DeclarativePieSeries(QObject *parent = 0);
40 QDeclarativeListProperty<QPieSlice> slices();
41
43
42 public Q_SLOTS:
44 public Q_SLOTS:
43 static void appendSlice(QDeclarativeListProperty<QPieSlice> *list,
45
44 QPieSlice *element);
46 public:
47 bool setPieModel(DeclarativePieModel *model);
48 DeclarativePieModel *pieModel();
45 };
49 };
46
50
47 QTCOMMERCIALCHART_END_NAMESPACE
51 QTCOMMERCIALCHART_END_NAMESPACE
@@ -30,6 +30,7
30 #include "declarativescatterseries.h"
30 #include "declarativescatterseries.h"
31 #include "declarativebarseries.h"
31 #include "declarativebarseries.h"
32 #include "declarativepieseries.h"
32 #include "declarativepieseries.h"
33 #include "declarativepiemodel.h"
33
34
34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35
36
@@ -41,7 +42,7 public:
41 {
42 {
42 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
43 Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart"));
43
44
44 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "Chart");
45 qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView");
45 qmlRegisterType<DeclarativeAxis>(uri, 1, 0, "Axis");
46 qmlRegisterType<DeclarativeAxis>(uri, 1, 0, "Axis");
46 qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint");
47 qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint");
47 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
48 qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries");
@@ -51,6 +52,8 public:
51 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
52 qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries");
52 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
53 qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries");
53 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
54 qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice");
55 // TODO: a declarative model for each type
56 qmlRegisterType<DeclarativePieModel>(uri, 1, 0, "PieModel");
54 }
57 }
55 };
58 };
56
59
@@ -29,7 +29,8 SOURCES += \
29 declarativeareaseries.cpp \
29 declarativeareaseries.cpp \
30 declarativescatterseries.cpp \
30 declarativescatterseries.cpp \
31 declarativepieseries.cpp \
31 declarativepieseries.cpp \
32 declarativebarseries.cpp
32 declarativebarseries.cpp \
33 declarativepiemodel.cpp
33 HEADERS += \
34 HEADERS += \
34 declarativechart.h \
35 declarativechart.h \
35 declarativeaxis.h \
36 declarativeaxis.h \
@@ -40,7 +41,8 HEADERS += \
40 declarativeareaseries.h \
41 declarativeareaseries.h \
41 declarativescatterseries.h \
42 declarativescatterseries.h \
42 declarativepieseries.h \
43 declarativepieseries.h \
43 declarativebarseries.h
44 declarativebarseries.h \
45 declarativepiemodel.h
44
46
45 TARGETPATH = QtCommercial/Chart
47 TARGETPATH = QtCommercial/Chart
46 target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
48 target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
@@ -37,7 +37,8 SOURCES += \
37 $$PWD/qabstractseries.cpp \
37 $$PWD/qabstractseries.cpp \
38 $$PWD/chartbackground.cpp \
38 $$PWD/chartbackground.cpp \
39 $$PWD/chart.cpp \
39 $$PWD/chart.cpp \
40 $$PWD/scroller.cpp
40 $$PWD/scroller.cpp \
41 $$PWD/charttablemodel.cpp
41 PRIVATE_HEADERS += \
42 PRIVATE_HEADERS += \
42 $$PWD/chartdataset_p.h \
43 $$PWD/chartdataset_p.h \
43 $$PWD/chartitem_p.h \
44 $$PWD/chartitem_p.h \
@@ -50,7 +51,8 PRIVATE_HEADERS += \
50 $$PWD/qchart_p.h \
51 $$PWD/qchart_p.h \
51 $$PWD/qchartview_p.h \
52 $$PWD/qchartview_p.h \
52 $$PWD/scroller_p.h \
53 $$PWD/scroller_p.h \
53 $$PWD/qabstractseries_p.h
54 $$PWD/qabstractseries_p.h \
55 $$PWD/charttablemodel.h
54 PUBLIC_HEADERS += \
56 PUBLIC_HEADERS += \
55 $$PWD/qchart.h \
57 $$PWD/qchart.h \
56 $$PWD/qchartglobal.h \
58 $$PWD/qchartglobal.h \
General Comments 0
You need to be logged in to leave comments. Login now