@@ -1,130 +1,117 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#include "c |
|
21 | #include "customtablemodel.h" | |
22 | #include <QVector> |
|
22 | #include <QVector> | |
23 | #include <QRect> |
|
23 | #include <QRect> | |
24 | #include <QColor> |
|
24 | #include <QColor> | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
26 | CustomTableModel::CustomTableModel(QObject *parent) : | |
27 |
|
||||
28 | ChartTableModel::ChartTableModel(QObject *parent) : |
|
|||
29 | QAbstractTableModel(parent), |
|
27 | QAbstractTableModel(parent), | |
30 | m_columnCount(0), |
|
28 | m_columnCount(0), | |
31 | m_rowCount(0) |
|
29 | m_rowCount(0) | |
32 | { |
|
30 | { | |
33 | } |
|
31 | } | |
34 |
|
32 | |||
35 |
int C |
|
33 | int CustomTableModel::rowCount(const QModelIndex & parent) const | |
36 | { |
|
34 | { | |
37 | Q_UNUSED(parent) |
|
35 | Q_UNUSED(parent) | |
38 | return m_data.count(); |
|
36 | return m_data.count(); | |
39 | } |
|
37 | } | |
40 |
|
38 | |||
41 |
int C |
|
39 | int CustomTableModel::columnCount(const QModelIndex & parent) const | |
42 | { |
|
40 | { | |
43 | Q_UNUSED(parent) |
|
41 | Q_UNUSED(parent) | |
44 | return m_columnCount; |
|
42 | return m_columnCount; | |
45 | } |
|
43 | } | |
46 |
|
44 | |||
47 |
QVariant C |
|
45 | QVariant CustomTableModel::headerData (int section, Qt::Orientation orientation, int role ) const | |
48 | { |
|
46 | { | |
49 | if (role != Qt::DisplayRole) |
|
47 | if (role != Qt::DisplayRole) | |
50 | return QVariant(); |
|
48 | return QVariant(); | |
51 |
|
49 | |||
52 | if (orientation == Qt::Horizontal) { |
|
50 | if (orientation == Qt::Horizontal) { | |
53 | if (section % 2 == 0) |
|
51 | if (section % 2 == 0) | |
54 | return "x"; |
|
52 | return "x"; | |
55 | else |
|
53 | else | |
56 | return "y"; |
|
54 | return "y"; | |
57 | } else { |
|
55 | } else { | |
58 | return QString("%1").arg(section + 1); |
|
56 | return QString("%1").arg(section + 1); | |
59 | } |
|
57 | } | |
60 | } |
|
58 | } | |
61 |
|
59 | |||
62 |
QVariant C |
|
60 | QVariant CustomTableModel::data(const QModelIndex &index, int role) const | |
63 | { |
|
61 | { | |
64 | if (role == Qt::DisplayRole) { |
|
62 | if (role == Qt::DisplayRole) { | |
65 | return m_data[index.row()]->at(index.column()); |
|
63 | return m_data[index.row()]->at(index.column()); | |
66 | } else if (role == Qt::EditRole) { |
|
64 | } else if (role == Qt::EditRole) { | |
67 | return m_data[index.row()]->at(index.column()); |
|
65 | return m_data[index.row()]->at(index.column()); | |
68 | } |
|
66 | } | |
69 | return QVariant(); |
|
67 | return QVariant(); | |
70 | } |
|
68 | } | |
71 |
|
69 | |||
72 |
bool C |
|
70 | bool CustomTableModel::setData(const QModelIndex &index, const QVariant &value, int role) | |
73 | { |
|
71 | { | |
74 | if (index.isValid() && role == Qt::EditRole) { |
|
72 | if (index.isValid() && role == Qt::EditRole) { | |
75 | m_data[index.row()]->replace(index.column(), value); |
|
73 | m_data[index.row()]->replace(index.column(), value); | |
76 | emit dataChanged(index, index); |
|
74 | emit dataChanged(index, index); | |
77 | return true; |
|
75 | return true; | |
78 | } |
|
76 | } | |
79 | return false; |
|
77 | return false; | |
80 | } |
|
78 | } | |
81 |
|
79 | |||
82 |
void C |
|
80 | void CustomTableModel::insertColumn(int column, const QModelIndex &parent) | |
83 | { |
|
81 | { | |
84 | beginInsertColumns(parent, column, column); |
|
82 | beginInsertColumns(parent, column, column); | |
85 | m_columnCount++; |
|
83 | m_columnCount++; | |
86 | endInsertColumns(); |
|
84 | endInsertColumns(); | |
87 | } |
|
85 | } | |
88 |
|
86 | |||
89 |
void C |
|
87 | void CustomTableModel::insertRow(int row, const QModelIndex &parent) | |
90 | { |
|
88 | { | |
91 | beginInsertRows(parent, row, row); |
|
89 | beginInsertRows(parent, row, row); | |
92 | QVector<QVariant>* dataVec = new QVector<QVariant>(m_columnCount); |
|
90 | QVector<QVariant>* dataVec = new QVector<QVariant>(m_columnCount); | |
93 | m_data.insert(row, dataVec); |
|
91 | m_data.insert(row, dataVec); | |
94 | endInsertRows(); |
|
92 | endInsertRows(); | |
95 | } |
|
93 | } | |
96 |
|
94 | |||
97 |
|
|
95 | bool CustomTableModel::removeRow(int row, const QModelIndex &parent) | |
98 | //{ |
|
|||
99 | // Q_UNUSED(parent) |
|
|||
100 | // Q_ASSERT(row >= 0 && row < rowCount); |
|
|||
101 |
|
||||
102 | // beginRemoveRows(parent, row, row); |
|
|||
103 | // m_data.removeAt(row); |
|
|||
104 | // endRemoveRows(); |
|
|||
105 | // return true; |
|
|||
106 | //} |
|
|||
107 |
|
||||
108 | bool ChartTableModel::removeRow(int row, const QModelIndex &parent) |
|
|||
109 | { |
|
96 | { | |
110 | return QAbstractTableModel::removeRow(row, parent); |
|
97 | return QAbstractTableModel::removeRow(row, parent); | |
111 | } |
|
98 | } | |
112 |
|
99 | |||
113 |
bool C |
|
100 | bool CustomTableModel::removeRows(int row, int count, const QModelIndex &parent) | |
114 | { |
|
101 | { | |
115 | beginRemoveRows(parent, row, row + count - 1); |
|
102 | beginRemoveRows(parent, row, row + count - 1); | |
116 | bool removed(false); |
|
103 | bool removed(false); | |
117 | for (int i(row); i < (row + count); i++) { |
|
104 | for (int i(row); i < (row + count); i++) { | |
118 | m_data.removeAt(i); |
|
105 | m_data.removeAt(i); | |
119 | removed = true; |
|
106 | removed = true; | |
120 | } |
|
107 | } | |
121 | endRemoveRows(); |
|
108 | endRemoveRows(); | |
122 | return removed; |
|
109 | return removed; | |
123 | } |
|
110 | } | |
124 |
|
111 | |||
125 |
Qt::ItemFlags C |
|
112 | Qt::ItemFlags CustomTableModel::flags ( const QModelIndex & index ) const | |
126 | { |
|
113 | { | |
127 | return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; |
|
114 | return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; | |
128 | } |
|
115 | } | |
129 |
|
116 | |||
130 |
#include "moc_c |
|
117 | #include "moc_customtablemodel.cpp" |
@@ -1,59 +1,53 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 |
#ifndef C |
|
21 | #ifndef CUSTOMTABLEMODEL_H | |
22 |
#define C |
|
22 | #define CUSTOMTABLEMODEL_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
|||
25 | #include <QAbstractTableModel> |
|
24 | #include <QAbstractTableModel> | |
26 | #include <QHash> |
|
25 | #include <QHash> | |
27 | #include <QRect> |
|
|||
28 |
|
26 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
27 | class CustomTableModel : public QAbstractTableModel | |
30 |
|
||||
31 | class QTCOMMERCIALCHART_EXPORT ChartTableModel : public QAbstractTableModel |
|
|||
32 | { |
|
28 | { | |
33 | Q_OBJECT |
|
29 | Q_OBJECT | |
34 | Q_PROPERTY(int count READ rowCount) |
|
30 | Q_PROPERTY(int count READ rowCount) | |
35 |
|
31 | |||
36 | public: |
|
32 | public: | |
37 |
explicit C |
|
33 | explicit CustomTableModel(QObject *parent = 0); | |
38 |
|
34 | |||
39 | int rowCount ( const QModelIndex & parent = QModelIndex() ) const; |
|
35 | int rowCount ( const QModelIndex & parent = QModelIndex() ) const; | |
40 | int columnCount ( const QModelIndex & parent = QModelIndex() ) const; |
|
36 | int columnCount ( const QModelIndex & parent = QModelIndex() ) const; | |
41 | QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; |
|
37 | QVariant headerData (int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; | |
42 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
|
38 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | |
43 | bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); |
|
39 | bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ); | |
44 | Qt::ItemFlags flags ( const QModelIndex & index ) const; |
|
40 | Qt::ItemFlags flags ( const QModelIndex & index ) const; | |
45 | void insertColumn(int column, const QModelIndex &parent = QModelIndex()); |
|
41 | void insertColumn(int column, const QModelIndex &parent = QModelIndex()); | |
46 | void insertRow(int row, const QModelIndex &parent = QModelIndex()); |
|
42 | void insertRow(int row, const QModelIndex &parent = QModelIndex()); | |
47 | /*Q_INVOKABLE*/ //bool removeRow(int row, const QModelIndex &parent = QModelIndex()); |
|
43 | /*Q_INVOKABLE*/ //bool removeRow(int row, const QModelIndex &parent = QModelIndex()); | |
48 | Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); |
|
44 | Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex & parent = QModelIndex()); | |
49 | Q_INVOKABLE bool removeRow (int row, const QModelIndex &parent = QModelIndex()); |
|
45 | Q_INVOKABLE bool removeRow (int row, const QModelIndex &parent = QModelIndex()); | |
50 |
|
46 | |||
51 | private: |
|
47 | private: | |
52 | QList<QVector<QVariant> * > m_data; |
|
48 | QList<QVector<QVariant> * > m_data; | |
53 | int m_columnCount; |
|
49 | int m_columnCount; | |
54 | int m_rowCount; |
|
50 | int m_rowCount; | |
55 | }; |
|
51 | }; | |
56 |
|
52 | |||
57 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | #endif // CUSTOMTABLEMODEL_H | |
58 |
|
||||
59 | #endif // CHARTTABLEMODEL_H |
|
@@ -1,114 +1,109 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include "declarativemodel.h" |
|
21 | #include "declarativemodel.h" | |
22 | #include <qdeclarativelist.h> |
|
22 | #include <qdeclarativelist.h> | |
23 | #include <QDebug> |
|
23 | #include <QDebug> | |
24 |
|
24 | |||
25 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
25 | ////////////// Table model element /////////////////// | |
26 |
|
||||
27 |
|
||||
28 | ////////////// Table model row /////////////////// |
|
|||
29 |
|
26 | |||
30 | DeclarativeTableModelElement::DeclarativeTableModelElement(QObject *parent) |
|
27 | DeclarativeTableModelElement::DeclarativeTableModelElement(QObject *parent) | |
31 | : QObject(parent) |
|
28 | : QObject(parent) | |
32 | { |
|
29 | { | |
33 | } |
|
30 | } | |
34 |
|
31 | |||
35 | QVariantList DeclarativeTableModelElement::values() |
|
32 | QVariantList DeclarativeTableModelElement::values() | |
36 | { |
|
33 | { | |
37 | return m_values; |
|
34 | return m_values; | |
38 | } |
|
35 | } | |
39 |
|
36 | |||
40 | void DeclarativeTableModelElement::setValues(QVariantList values) |
|
37 | void DeclarativeTableModelElement::setValues(QVariantList values) | |
41 | { |
|
38 | { | |
42 | m_values = values; |
|
39 | m_values = values; | |
43 | } |
|
40 | } | |
44 |
|
41 | |||
45 | ////////////// Table model /////////////////// |
|
42 | ////////////// Table model /////////////////// | |
46 |
|
43 | |||
47 | DeclarativeTableModel::DeclarativeTableModel(QObject *parent) : |
|
44 | DeclarativeTableModel::DeclarativeTableModel(QObject *parent) : | |
48 |
C |
|
45 | CustomTableModel(parent) | |
49 | { |
|
46 | { | |
50 | } |
|
47 | } | |
51 |
|
48 | |||
52 | void DeclarativeTableModel::classBegin() |
|
49 | void DeclarativeTableModel::classBegin() | |
53 | { |
|
50 | { | |
54 | } |
|
51 | } | |
55 |
|
52 | |||
56 | void DeclarativeTableModel::componentComplete() |
|
53 | void DeclarativeTableModel::componentComplete() | |
57 | { |
|
54 | { | |
58 | foreach (QObject *child, children()) { |
|
55 | foreach (QObject *child, children()) { | |
59 | if (qobject_cast<DeclarativeTableModelElement *>(child)) { |
|
56 | if (qobject_cast<DeclarativeTableModelElement *>(child)) { | |
60 | append(qobject_cast<DeclarativeTableModelElement *>(child)->values()); |
|
57 | append(qobject_cast<DeclarativeTableModelElement *>(child)->values()); | |
61 | } |
|
58 | } | |
62 | } |
|
59 | } | |
63 | } |
|
60 | } | |
64 |
|
61 | |||
65 | QDeclarativeListProperty<QObject> DeclarativeTableModel::modelChildren() |
|
62 | QDeclarativeListProperty<QObject> DeclarativeTableModel::modelChildren() | |
66 | { |
|
63 | { | |
67 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeTableModel::appendModelChild); |
|
64 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeTableModel::appendModelChild); | |
68 | } |
|
65 | } | |
69 |
|
66 | |||
70 | void DeclarativeTableModel::appendModelChild(QDeclarativeListProperty<QObject> *list, |
|
67 | void DeclarativeTableModel::appendModelChild(QDeclarativeListProperty<QObject> *list, | |
71 | QObject *child) |
|
68 | QObject *child) | |
72 | { |
|
69 | { | |
73 | // childs are added in componentComplete instead |
|
70 | // childs are added in componentComplete instead | |
74 | Q_UNUSED(list) |
|
71 | Q_UNUSED(list) | |
75 | Q_UNUSED(child) |
|
72 | Q_UNUSED(child) | |
76 | } |
|
73 | } | |
77 |
|
74 | |||
78 | void DeclarativeTableModel::append(QVariantList values) |
|
75 | void DeclarativeTableModel::append(QVariantList values) | |
79 | { |
|
76 | { | |
80 | // qDebug() << "DeclarativeTableModel::append:" << values; |
|
77 | // qDebug() << "DeclarativeTableModel::append:" << values; | |
81 |
|
78 | |||
82 | while (columnCount() < values.count()) |
|
79 | while (columnCount() < values.count()) | |
83 | insertColumn(columnCount()); |
|
80 | insertColumn(columnCount()); | |
84 |
|
81 | |||
85 | insertRow(rowCount()); |
|
82 | insertRow(rowCount()); | |
86 |
|
83 | |||
87 | QModelIndex beginIndex = QModelIndex(); |
|
84 | QModelIndex beginIndex = QModelIndex(); | |
88 | QModelIndex endIndex = QModelIndex(); |
|
85 | QModelIndex endIndex = QModelIndex(); | |
89 | for (int i(0); i < values.count(); i++) { |
|
86 | for (int i(0); i < values.count(); i++) { | |
90 | QModelIndex modelIndex = createIndex(rowCount() - 1, i); |
|
87 | QModelIndex modelIndex = createIndex(rowCount() - 1, i); | |
91 | if (i == 0) |
|
88 | if (i == 0) | |
92 | beginIndex = modelIndex; |
|
89 | beginIndex = modelIndex; | |
93 | if (i == (values.count() - 1)) |
|
90 | if (i == (values.count() - 1)) | |
94 | endIndex = modelIndex; |
|
91 | endIndex = modelIndex; | |
95 | setData(modelIndex, values.at(i)); |
|
92 | setData(modelIndex, values.at(i)); | |
96 | } |
|
93 | } | |
97 | dataChanged(beginIndex, endIndex); |
|
94 | dataChanged(beginIndex, endIndex); | |
98 | } |
|
95 | } | |
99 |
|
96 | |||
100 | void DeclarativeTableModel::appendPoint(QXYModelMapper *mapper, DeclarativeXyPoint *point) |
|
97 | //void DeclarativeTableModel::appendPoint(QXYModelMapper *mapper, DeclarativeXyPoint *point) | |
101 | { |
|
98 | //{ | |
102 | Q_UNUSED(mapper) |
|
99 | // Q_UNUSED(mapper) | |
103 | Q_UNUSED(point) |
|
100 | // Q_UNUSED(point) | |
104 | // TODO: XYModelMapper implementation has change, this code has to be updated. |
|
101 | // // TODO: XYModelMapper implementation has change, this code has to be updated. | |
105 | // qDebug() << "DeclarativeTableModel::appendPoint:" << point; |
|
102 | //// qDebug() << "DeclarativeTableModel::appendPoint:" << point; | |
106 | // QVariantList values; |
|
103 | //// QVariantList values; | |
107 | // values.insert(mapper->mapX(), point->x()); |
|
104 | //// values.insert(mapper->mapX(), point->x()); | |
108 | // values.insert(mapper->mapY(), point->y()); |
|
105 | //// values.insert(mapper->mapY(), point->y()); | |
109 | // append(values); |
|
106 | //// append(values); | |
110 | } |
|
107 | //} | |
111 |
|
108 | |||
112 | #include "moc_declarativemodel.cpp" |
|
109 | #include "moc_declarativemodel.cpp" | |
113 |
|
||||
114 | QTCOMMERCIALCHART_END_NAMESPACE |
|
@@ -1,76 +1,64 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVEMODEL_H |
|
21 | #ifndef DECLARATIVEMODEL_H | |
22 | #define DECLARATIVEMODEL_H |
|
22 | #define DECLARATIVEMODEL_H | |
23 |
|
23 | |||
24 |
#include " |
|
24 | #include "customtablemodel.h" | |
25 | #include "declarativexypoint.h" |
|
|||
26 | #include <QPieSlice> |
|
|||
27 | #include "../src/charttablemodel.h" // TODO |
|
|||
28 | #include <QBarSet> |
|
|||
29 | #include <QXYModelMapper> |
|
|||
30 | #include <QDeclarativeListProperty> |
|
25 | #include <QDeclarativeListProperty> | |
31 | #include <QVariant> |
|
26 | #include <QVariant> | |
32 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
33 |
|
28 | |||
34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
|||
35 |
|
||||
36 | // TODO: move model into demo app, |
|
|||
37 | // the ChartModel API will not be implemented by charts declarative plugin |
|
|||
38 |
|
||||
39 | class DeclarativeTableModelElement : public QObject |
|
29 | class DeclarativeTableModelElement : public QObject | |
40 | { |
|
30 | { | |
41 | Q_OBJECT |
|
31 | Q_OBJECT | |
42 | Q_PROPERTY(QVariantList values READ values WRITE setValues) |
|
32 | Q_PROPERTY(QVariantList values READ values WRITE setValues) | |
43 |
|
33 | |||
44 | public: |
|
34 | public: | |
45 | explicit DeclarativeTableModelElement(QObject *parent = 0); |
|
35 | explicit DeclarativeTableModelElement(QObject *parent = 0); | |
46 | QVariantList values(); |
|
36 | QVariantList values(); | |
47 | void setValues(QVariantList values); |
|
37 | void setValues(QVariantList values); | |
48 | private: |
|
38 | private: | |
49 | QVariantList m_values; |
|
39 | QVariantList m_values; | |
50 | }; |
|
40 | }; | |
51 |
|
41 | |||
52 |
class DeclarativeTableModel : public C |
|
42 | class DeclarativeTableModel : public CustomTableModel, public QDeclarativeParserStatus | |
53 | { |
|
43 | { | |
54 | Q_OBJECT |
|
44 | Q_OBJECT | |
55 | Q_INTERFACES(QDeclarativeParserStatus) |
|
45 | Q_INTERFACES(QDeclarativeParserStatus) | |
56 | Q_PROPERTY(QDeclarativeListProperty<QObject> modelChildren READ modelChildren) |
|
46 | Q_PROPERTY(QDeclarativeListProperty<QObject> modelChildren READ modelChildren) | |
57 | Q_CLASSINFO("DefaultProperty", "modelChildren") |
|
47 | Q_CLASSINFO("DefaultProperty", "modelChildren") | |
58 |
|
48 | |||
59 | public: |
|
49 | public: | |
60 | explicit DeclarativeTableModel(QObject *parent = 0); |
|
50 | explicit DeclarativeTableModel(QObject *parent = 0); | |
61 | QDeclarativeListProperty<QObject> modelChildren(); |
|
51 | QDeclarativeListProperty<QObject> modelChildren(); | |
62 | void appendPoint(QXYModelMapper *mapper, DeclarativeXyPoint *point); |
|
52 | // void appendPoint(QXYModelMapper *mapper, DeclarativeXyPoint *point); | |
63 |
|
53 | |||
64 | public: // from QDeclarativeParserStatus |
|
54 | public: // from QDeclarativeParserStatus | |
65 | void classBegin(); |
|
55 | void classBegin(); | |
66 | void componentComplete(); |
|
56 | void componentComplete(); | |
67 |
|
57 | |||
68 | public Q_SLOTS: |
|
58 | public Q_SLOTS: | |
69 | void append(QVariantList slices); |
|
59 | void append(QVariantList slices); | |
70 | static void appendModelChild(QDeclarativeListProperty<QObject> *list, |
|
60 | static void appendModelChild(QDeclarativeListProperty<QObject> *list, | |
71 | QObject *element); |
|
61 | QObject *element); | |
72 | }; |
|
62 | }; | |
73 |
|
63 | |||
74 | QTCOMMERCIALCHART_END_NAMESPACE |
|
|||
75 |
|
||||
76 | #endif // DECLARATIVEMODEL_H |
|
64 | #endif // DECLARATIVEMODEL_H |
@@ -1,35 +1,47 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QtGui/QApplication> |
|
21 | #include <QtGui/QApplication> | |
22 | #include <QDeclarativeEngine> |
|
22 | #include <QDeclarativeEngine> | |
|
23 | #include <QtDeclarative> | |||
|
24 | #include <QAbstractItemModel> | |||
|
25 | #include "declarativemodel.h" | |||
|
26 | #include "customtablemodel.h" | |||
23 | #include "qmlapplicationviewer.h" |
|
27 | #include "qmlapplicationviewer.h" | |
24 |
|
28 | |||
|
29 | const char *uri = "QmlCustomModel"; | |||
|
30 | ||||
25 | Q_DECL_EXPORT int main(int argc, char *argv[]) |
|
31 | Q_DECL_EXPORT int main(int argc, char *argv[]) | |
26 | { |
|
32 | { | |
27 | QScopedPointer<QApplication> app(createApplication(argc, argv)); |
|
33 | QScopedPointer<QApplication> app(createApplication(argc, argv)); | |
28 | QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); |
|
34 | QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create()); | |
29 |
|
35 | |||
|
36 | // @uri QmlCustomModel | |||
|
37 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", | |||
|
38 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); | |||
|
39 | qmlRegisterType<DeclarativeTableModel>(uri, 1, 0, "CustomModel"); | |||
|
40 | qmlRegisterType<DeclarativeTableModelElement>(uri, 1, 0, "CustomModelElement"); | |||
|
41 | ||||
30 | viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); |
|
42 | viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); | |
31 | viewer->setSource(QUrl("qrc:/qml/qmlcustommodel/loader.qml")); |
|
43 | viewer->setSource(QUrl("qrc:/qml/qmlcustommodel/loader.qml")); | |
32 | viewer->showExpanded(); |
|
44 | viewer->showExpanded(); | |
33 |
|
45 | |||
34 | return app->exec(); |
|
46 | return app->exec(); | |
35 | } |
|
47 | } |
@@ -1,102 +1,102 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | import QtQuick 1.0 |
|
21 | import QtQuick 1.0 | |
22 | import QtCommercial.Chart 1.0 |
|
22 | import QtCommercial.Chart 1.0 | |
|
23 | import QmlCustomModel 1.0 | |||
23 |
|
24 | |||
24 | Rectangle { |
|
25 | Rectangle { | |
25 | width: parent.width |
|
26 | width: parent.width | |
26 | height: parent.height |
|
27 | height: parent.height | |
27 |
|
28 | |||
28 | ChartView { |
|
29 | ChartView { | |
29 | id: chart |
|
30 | id: chart | |
30 | title: "Custom model example" |
|
31 | title: "Custom model example" | |
31 | anchors.fill: parent |
|
32 | anchors.fill: parent | |
32 | theme: ChartView.ChartThemeLight |
|
33 | theme: ChartView.ChartThemeLight | |
33 |
|
34 | |||
34 | // For dynamic data you can use the ChartModel API. |
|
35 | // For dynamic data we use a custom data model derived from QAbstractiItemModel | |
35 |
C |
|
36 | CustomModel { | |
36 |
id: c |
|
37 | id: customModel | |
37 |
C |
|
38 | CustomModelElement { values: ["Volkswagen", 13.5, 4.4] } | |
38 |
C |
|
39 | CustomModelElement { values: ["Toyota", 10.9, 4.2] } | |
39 |
C |
|
40 | CustomModelElement { values: ["Ford", 8.6, 3.0] } | |
40 |
C |
|
41 | CustomModelElement { values: ["Skoda", 8.2, 1.9] } | |
41 |
C |
|
42 | CustomModelElement { values: ["Volvo", 6.8, 1.5] } | |
42 | } |
|
43 | } | |
43 |
|
44 | |||
44 | LineSeries { |
|
45 | LineSeries { | |
45 | name: "line" |
|
46 | name: "line" | |
46 |
|
47 | |||
47 | // TODO: the new mapper api |
|
48 | // TODO: the new mapper api | |
48 | // VXYModelMapper { |
|
49 | // VXYModelMapper { | |
49 |
// model: c |
|
50 | // model: customModel | |
50 | // xColumn: 0 |
|
51 | // xColumn: 0 | |
51 | // yColumn: 1 |
|
52 | // yColumn: 1 | |
52 | // } |
|
53 | // } | |
53 | } |
|
54 | } | |
54 |
|
55 | |||
55 |
|
56 | |||
56 | PieSeries { |
|
57 | PieSeries { | |
57 | id: pieSeries |
|
58 | id: pieSeries | |
58 | size: 0.4 |
|
59 | size: 0.4 | |
59 | horizontalPosition: 0.2 |
|
60 | horizontalPosition: 0.2 | |
60 | verticalPosition: 0.3 |
|
61 | verticalPosition: 0.3 | |
61 | } |
|
62 | } | |
62 |
|
63 | |||
63 | VPieModelMapper { |
|
64 | VPieModelMapper { | |
64 | series: pieSeries |
|
65 | series: pieSeries | |
65 |
model: c |
|
66 | model: customModel | |
66 | labelsColumn: 0 |
|
67 | labelsColumn: 0 | |
67 | valuesColumn: 1 |
|
68 | valuesColumn: 1 | |
68 | } |
|
69 | } | |
69 |
|
70 | |||
70 | // AreaSeries { |
|
71 | // AreaSeries { | |
71 | // name: "area" |
|
72 | // name: "area" | |
72 | // upperSeries: LineSeries {} |
|
73 | // upperSeries: LineSeries {} | |
73 | // lowerSeries: LineSeries {} |
|
74 | // lowerSeries: LineSeries {} | |
74 | // } |
|
75 | // } | |
75 |
|
76 | |||
76 | // TODO: BarSeries with ChartModel base model API |
|
|||
77 | // BarSeries { |
|
77 | // BarSeries { | |
78 |
// model: c |
|
78 | // model: customModel | |
79 | // modelMapper.first: 0 |
|
79 | // modelMapper.first: 0 | |
80 | // } |
|
80 | // } | |
81 | } |
|
81 | } | |
82 |
|
82 | |||
83 |
|
83 | |||
84 | // TODO: you could also implement appending to your model, for example: |
|
84 | // TODO: you could also implement appending to your model, for example: | |
85 | // pieSeries.model.append(["Others", 52.0]); |
|
85 | // pieSeries.model.append(["Others", 52.0]); | |
86 |
|
86 | |||
87 | // TODO: show how to use data from a list model in a chart view |
|
87 | // TODO: show how to use data from a list model in a chart view | |
88 |
// i.e. copy the data into a c |
|
88 | // i.e. copy the data into a custom model | |
89 | // ListModel { |
|
89 | // ListModel { | |
90 | // id: listModel |
|
90 | // id: listModel | |
91 | // ListElement { |
|
91 | // ListElement { | |
92 | // label: "Volkswagen" |
|
92 | // label: "Volkswagen" | |
93 | // value: 13.5 |
|
93 | // value: 13.5 | |
94 | // } |
|
94 | // } | |
95 | // ListElement { |
|
95 | // ListElement { | |
96 | // label: "Toyota" |
|
96 | // label: "Toyota" | |
97 | // value: 10.9 |
|
97 | // value: 10.9 | |
98 | // } |
|
98 | // } | |
99 | // // and so on... |
|
99 | // // and so on... | |
100 | // } |
|
100 | // } | |
101 |
|
101 | |||
102 | } |
|
102 | } |
@@ -1,10 +1,14 | |||||
1 | !include( ../demos.pri ) { |
|
1 | !include( ../demos.pri ) { | |
2 | error( "Couldn't find the demos.pri file!" ) |
|
2 | error( "Couldn't find the demos.pri file!" ) | |
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | RESOURCES += resources.qrc |
|
5 | RESOURCES += resources.qrc | |
6 | SOURCES += main.cpp |
|
6 | SOURCES += main.cpp\ | |
|
7 | customtablemodel.cpp \ | |||
|
8 | declarativemodel.cpp | |||
|
9 | HEADERS += customtablemodel.h \ | |||
|
10 | declarativemodel.h | |||
7 |
|
11 | |||
8 | include(qmlapplicationviewer/qmlapplicationviewer.pri) |
|
12 | include(qmlapplicationviewer/qmlapplicationviewer.pri) | |
9 |
|
13 | |||
10 | !system_build:mac: QMAKE_POST_LINK += "$$MAC_POST_LINK_PREFIX $$MAC_DEMOS_BIN_DIR" |
|
14 | !system_build:mac: QMAKE_POST_LINK += "$$MAC_POST_LINK_PREFIX $$MAC_DEMOS_BIN_DIR" |
@@ -1,47 +1,45 | |||||
1 | TARGET = qtcommercialchartqml |
|
1 | TARGET = qtcommercialchartqml | |
2 | QT += declarative |
|
2 | QT += declarative | |
3 |
|
3 | |||
4 | !include( ../plugins.pri ) { |
|
4 | !include( ../plugins.pri ) { | |
5 | error( "Couldn't find the plugins.pri file!" ) |
|
5 | error( "Couldn't find the plugins.pri file!" ) | |
6 | } |
|
6 | } | |
7 |
|
7 | |||
8 | contains(QT_MAJOR_VERSION, 5) { |
|
8 | contains(QT_MAJOR_VERSION, 5) { | |
9 | # TODO: QtQuick2 not supported by the implementation currently |
|
9 | # TODO: QtQuick2 not supported by the implementation currently | |
10 | DEFINES += QTQUICK2 |
|
10 | DEFINES += QTQUICK2 | |
11 | } |
|
11 | } | |
12 |
|
12 | |||
13 | SOURCES += \ |
|
13 | SOURCES += \ | |
14 | plugin.cpp \ |
|
14 | plugin.cpp \ | |
15 | declarativechart.cpp \ |
|
15 | declarativechart.cpp \ | |
16 | declarativexypoint.cpp \ |
|
16 | declarativexypoint.cpp \ | |
17 | declarativexyseries.cpp \ |
|
17 | declarativexyseries.cpp \ | |
18 | declarativelineseries.cpp \ |
|
18 | declarativelineseries.cpp \ | |
19 | declarativesplineseries.cpp \ |
|
19 | declarativesplineseries.cpp \ | |
20 | declarativeareaseries.cpp \ |
|
20 | declarativeareaseries.cpp \ | |
21 | declarativescatterseries.cpp \ |
|
21 | declarativescatterseries.cpp \ | |
22 | declarativepieseries.cpp \ |
|
22 | declarativepieseries.cpp \ | |
23 |
declarativebarseries.cpp |
|
23 | declarativebarseries.cpp | |
24 | declarativemodel.cpp |
|
|||
25 |
|
24 | |||
26 | HEADERS += \ |
|
25 | HEADERS += \ | |
27 | declarativechart.h \ |
|
26 | declarativechart.h \ | |
28 | declarativexypoint.h \ |
|
27 | declarativexypoint.h \ | |
29 | declarativexyseries.h \ |
|
28 | declarativexyseries.h \ | |
30 | declarativelineseries.h \ |
|
29 | declarativelineseries.h \ | |
31 | declarativesplineseries.h \ |
|
30 | declarativesplineseries.h \ | |
32 | declarativeareaseries.h \ |
|
31 | declarativeareaseries.h \ | |
33 | declarativescatterseries.h \ |
|
32 | declarativescatterseries.h \ | |
34 | declarativepieseries.h \ |
|
33 | declarativepieseries.h \ | |
35 |
declarativebarseries.h |
|
34 | declarativebarseries.h | |
36 | declarativemodel.h |
|
|||
37 |
|
35 | |||
38 | TARGETPATH = QtCommercial/Chart |
|
36 | TARGETPATH = QtCommercial/Chart | |
39 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
|
37 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH | |
40 | qmldir.files += $$PWD/qmldir |
|
38 | qmldir.files += $$PWD/qmldir | |
41 | qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
|
39 | qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH | |
42 | INSTALLS += target qmldir |
|
40 | INSTALLS += target qmldir | |
43 |
|
41 | |||
44 | FILE = $$PWD/qmldir |
|
42 | FILE = $$PWD/qmldir | |
45 | win32:{FILE = $$replace(FILE, "/","\\")} |
|
43 | win32:{FILE = $$replace(FILE, "/","\\")} | |
46 | QMAKE_POST_LINK += $$QMAKE_COPY $$FILE $$CHART_BUILD_PLUGIN_DIR |
|
44 | QMAKE_POST_LINK += $$QMAKE_COPY $$FILE $$CHART_BUILD_PLUGIN_DIR | |
47 | !system_build:mac: QMAKE_POST_LINK += " & $$MAC_POST_LINK_PREFIX $$MAC_PLUGINS_BIN_DIR" |
|
45 | !system_build:mac: QMAKE_POST_LINK += " & $$MAC_POST_LINK_PREFIX $$MAC_PLUGINS_BIN_DIR" |
@@ -1,55 +1,51 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVEAREASERIES_H |
|
21 | #ifndef DECLARATIVEAREASERIES_H | |
22 | #define DECLARATIVEAREASERIES_H |
|
22 | #define DECLARATIVEAREASERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qareaseries.h" |
|
25 | #include "qareaseries.h" | |
26 | #include "declarativelineseries.h" |
|
26 | #include "declarativelineseries.h" | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | class DeclarativeAreaSeries : public QAreaSeries |
|
30 | class DeclarativeAreaSeries : public QAreaSeries | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries) |
|
33 | Q_PROPERTY(DeclarativeLineSeries *upperSeries READ upperSeries WRITE setUpperSeries) | |
34 | Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries) |
|
34 | Q_PROPERTY(DeclarativeLineSeries *lowerSeries READ lowerSeries WRITE setLowerSeries) | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | explicit DeclarativeAreaSeries(QObject *parent = 0); |
|
37 | explicit DeclarativeAreaSeries(QObject *parent = 0); | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | bool setDeclarativeUpperModel(DeclarativeTableModel *model); |
|
|||
41 | DeclarativeTableModel *declarativeUpperModel(); |
|
|||
42 | bool setDeclarativeLowerModel(DeclarativeTableModel *model); |
|
|||
43 | DeclarativeTableModel *declarativeLowerModel(); |
|
|||
44 | QXYModelMapper* upperModelMapper() const; |
|
40 | QXYModelMapper* upperModelMapper() const; | |
45 | QXYModelMapper* lowerModelMapper() const; |
|
41 | QXYModelMapper* lowerModelMapper() const; | |
46 | public: |
|
42 | public: | |
47 | void setUpperSeries(DeclarativeLineSeries* series); |
|
43 | void setUpperSeries(DeclarativeLineSeries* series); | |
48 | DeclarativeLineSeries* upperSeries() const; |
|
44 | DeclarativeLineSeries* upperSeries() const; | |
49 | void setLowerSeries(DeclarativeLineSeries* series); |
|
45 | void setLowerSeries(DeclarativeLineSeries* series); | |
50 | DeclarativeLineSeries* lowerSeries() const; |
|
46 | DeclarativeLineSeries* lowerSeries() const; | |
51 | }; |
|
47 | }; | |
52 |
|
48 | |||
53 | QTCOMMERCIALCHART_END_NAMESPACE |
|
49 | QTCOMMERCIALCHART_END_NAMESPACE | |
54 |
|
50 | |||
55 | #endif // DECLARATIVEAREASERIES_H |
|
51 | #endif // DECLARATIVEAREASERIES_H |
@@ -1,99 +1,99 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVEBARSERIES_H |
|
21 | #ifndef DECLARATIVEBARSERIES_H | |
22 | #define DECLARATIVEBARSERIES_H |
|
22 | #define DECLARATIVEBARSERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "declarativemodel.h" |
|
|||
26 | #include <QDeclarativeItem> |
|
25 | #include <QDeclarativeItem> | |
27 | #include <QDeclarativeParserStatus> |
|
26 | #include <QDeclarativeParserStatus> | |
28 | #include <QGroupedBarSeries> |
|
27 | #include <QGroupedBarSeries> | |
|
28 | #include <QBarSet> | |||
29 |
|
29 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | class QChart; |
|
32 | class QChart; | |
33 |
|
33 | |||
34 | class DeclarativeBarSet : public QBarSet |
|
34 | class DeclarativeBarSet : public QBarSet | |
35 | { |
|
35 | { | |
36 | Q_OBJECT |
|
36 | Q_OBJECT | |
37 | Q_PROPERTY(QVariantList values READ values WRITE setValues) |
|
37 | Q_PROPERTY(QVariantList values READ values WRITE setValues) | |
38 | Q_PROPERTY(QString name READ name WRITE setName) |
|
38 | Q_PROPERTY(QString name READ name WRITE setName) | |
39 |
|
39 | |||
40 | public: |
|
40 | public: | |
41 | explicit DeclarativeBarSet(QObject *parent = 0); |
|
41 | explicit DeclarativeBarSet(QObject *parent = 0); | |
42 | QVariantList values(); |
|
42 | QVariantList values(); | |
43 | void setValues(QVariantList values); |
|
43 | void setValues(QVariantList values); | |
44 |
|
44 | |||
45 | public: // From QBarSet |
|
45 | public: // From QBarSet | |
46 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } |
|
46 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } | |
47 | Q_INVOKABLE void append(qreal x, qreal y) { QBarSet::append(QPointF(x, y)); } |
|
47 | Q_INVOKABLE void append(qreal x, qreal y) { QBarSet::append(QPointF(x, y)); } | |
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus |
|
50 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus | |
51 | { |
|
51 | { | |
52 | Q_OBJECT |
|
52 | Q_OBJECT | |
53 | Q_INTERFACES(QDeclarativeParserStatus) |
|
53 | Q_INTERFACES(QDeclarativeParserStatus) | |
54 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) |
|
54 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) | |
55 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) |
|
55 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) | |
56 | Q_CLASSINFO("DefaultProperty", "initialBarSets") |
|
56 | Q_CLASSINFO("DefaultProperty", "initialBarSets") | |
57 |
|
57 | |||
58 | public: |
|
58 | public: | |
59 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); |
|
59 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); | |
60 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); |
|
60 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); | |
61 |
|
61 | |||
62 | void setBarCategories(QStringList categories); |
|
62 | void setBarCategories(QStringList categories); | |
63 | QStringList barCategories(); |
|
63 | QStringList barCategories(); | |
64 |
|
64 | |||
65 | public: // from QDeclarativeParserStatus |
|
65 | public: // from QDeclarativeParserStatus | |
66 | void classBegin(); |
|
66 | void classBegin(); | |
67 | void componentComplete(); |
|
67 | void componentComplete(); | |
68 |
|
68 | |||
69 | public Q_SLOTS: |
|
69 | public Q_SLOTS: | |
70 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} |
|
70 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} | |
71 | }; |
|
71 | }; | |
72 |
|
72 | |||
73 | class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativeParserStatus |
|
73 | class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativeParserStatus | |
74 | { |
|
74 | { | |
75 | Q_OBJECT |
|
75 | Q_OBJECT | |
76 | Q_INTERFACES(QDeclarativeParserStatus) |
|
76 | Q_INTERFACES(QDeclarativeParserStatus) | |
77 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) |
|
77 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) | |
78 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) |
|
78 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) | |
79 | Q_CLASSINFO("DefaultProperty", "initialBarSets") |
|
79 | Q_CLASSINFO("DefaultProperty", "initialBarSets") | |
80 |
|
80 | |||
81 | public: |
|
81 | public: | |
82 | explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0); |
|
82 | explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0); | |
83 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); |
|
83 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); | |
84 |
|
84 | |||
85 | public: // from QDeclarativeParserStatus |
|
85 | public: // from QDeclarativeParserStatus | |
86 | void classBegin(); |
|
86 | void classBegin(); | |
87 | void componentComplete(); |
|
87 | void componentComplete(); | |
88 |
|
88 | |||
89 | public: |
|
89 | public: | |
90 | void setBarCategories(QStringList categories); |
|
90 | void setBarCategories(QStringList categories); | |
91 | QStringList barCategories(); |
|
91 | QStringList barCategories(); | |
92 |
|
92 | |||
93 | public Q_SLOTS: |
|
93 | public Q_SLOTS: | |
94 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} |
|
94 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} | |
95 | }; |
|
95 | }; | |
96 |
|
96 | |||
97 | QTCOMMERCIALCHART_END_NAMESPACE |
|
97 | QTCOMMERCIALCHART_END_NAMESPACE | |
98 |
|
98 | |||
99 | #endif // DECLARATIVEBARSERIES_H |
|
99 | #endif // DECLARATIVEBARSERIES_H |
@@ -1,55 +1,55 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVELINESERIES_H |
|
21 | #ifndef DECLARATIVELINESERIES_H | |
22 | #define DECLARATIVELINESERIES_H |
|
22 | #define DECLARATIVELINESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qlineseries.h" |
|
25 | #include "qlineseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 | #include <QDebug> |
|
28 | #include <QDeclarativeListProperty> | |
29 |
|
29 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries |
|
32 | class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries | |
33 | { |
|
33 | { | |
34 | Q_OBJECT |
|
34 | Q_OBJECT | |
35 | Q_PROPERTY(QColor color READ penColor WRITE setPenColor) |
|
35 | Q_PROPERTY(QColor color READ penColor WRITE setPenColor) | |
36 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
36 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) | |
37 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
37 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | explicit DeclarativeLineSeries(QObject *parent = 0); |
|
40 | explicit DeclarativeLineSeries(QObject *parent = 0); | |
41 | QDeclarativeListProperty<QObject> declarativeChildren(); |
|
41 | QDeclarativeListProperty<QObject> declarativeChildren(); | |
42 |
|
42 | |||
43 | public: // from QLineSeries |
|
43 | public: // from QLineSeries | |
44 | Q_INVOKABLE void append(qreal x, qreal y) { QLineSeries::append(x, y); } |
|
44 | Q_INVOKABLE void append(qreal x, qreal y) { QLineSeries::append(x, y); } | |
45 | Q_INVOKABLE void remove(qreal x, qreal y) { QLineSeries::remove(x, y); } |
|
45 | Q_INVOKABLE void remove(qreal x, qreal y) { QLineSeries::remove(x, y); } | |
46 | Q_INVOKABLE void clear() { QLineSeries::removeAll(); } |
|
46 | Q_INVOKABLE void clear() { QLineSeries::removeAll(); } | |
47 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } |
|
47 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } | |
48 |
|
48 | |||
49 | public Q_SLOTS: |
|
49 | public Q_SLOTS: | |
50 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
50 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); | |
51 | }; |
|
51 | }; | |
52 |
|
52 | |||
53 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | QTCOMMERCIALCHART_END_NAMESPACE | |
54 |
|
54 | |||
55 | #endif // DECLARATIVELINESERIES_H |
|
55 | #endif // DECLARATIVELINESERIES_H |
@@ -1,77 +1,76 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVEPIESERIES_H |
|
21 | #ifndef DECLARATIVEPIESERIES_H | |
22 | #define DECLARATIVEPIESERIES_H |
|
22 | #define DECLARATIVEPIESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include <QPieSlice> |
|
25 | #include <QPieSlice> | |
26 | #include <QPieSeries> |
|
26 | #include <QPieSeries> | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 | #include <QDeclarativeListProperty> |
|
28 | #include <QDeclarativeListProperty> | |
29 | #include <QAbstractItemModel> |
|
29 | #include <QAbstractItemModel> | |
30 | #include "declarativemodel.h" |
|
|||
31 |
|
30 | |||
32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
33 |
|
32 | |||
34 | class QChart; |
|
33 | class QChart; | |
35 |
|
34 | |||
36 | class DeclarativePieSlice: public QPieSlice |
|
35 | class DeclarativePieSlice: public QPieSlice | |
37 | { |
|
36 | { | |
38 | Q_OBJECT |
|
37 | Q_OBJECT | |
39 | Q_PROPERTY(QColor color READ color WRITE setColor) |
|
38 | Q_PROPERTY(QColor color READ color WRITE setColor) | |
40 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) |
|
39 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor) | |
41 | Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth) |
|
40 | Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth) | |
42 |
|
41 | |||
43 | public: |
|
42 | public: | |
44 | explicit DeclarativePieSlice(QObject *parent = 0); |
|
43 | explicit DeclarativePieSlice(QObject *parent = 0); | |
45 | QColor color(); |
|
44 | QColor color(); | |
46 | void setColor(QColor color); |
|
45 | void setColor(QColor color); | |
47 | QColor borderColor(); |
|
46 | QColor borderColor(); | |
48 | void setBorderColor(QColor color); |
|
47 | void setBorderColor(QColor color); | |
49 | int borderWidth(); |
|
48 | int borderWidth(); | |
50 | void setBorderWidth(int width); |
|
49 | void setBorderWidth(int width); | |
51 | }; |
|
50 | }; | |
52 |
|
51 | |||
53 | class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus |
|
52 | class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus | |
54 | { |
|
53 | { | |
55 | Q_OBJECT |
|
54 | Q_OBJECT | |
56 | Q_INTERFACES(QDeclarativeParserStatus) |
|
55 | Q_INTERFACES(QDeclarativeParserStatus) | |
57 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
56 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) | |
58 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
57 | Q_CLASSINFO("DefaultProperty", "seriesChildren") | |
59 |
|
58 | |||
60 | public: |
|
59 | public: | |
61 | explicit DeclarativePieSeries(QObject *parent = 0); |
|
60 | explicit DeclarativePieSeries(QObject *parent = 0); | |
62 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
61 | QDeclarativeListProperty<QObject> seriesChildren(); | |
63 | Q_INVOKABLE DeclarativePieSlice *at(int index); |
|
62 | Q_INVOKABLE DeclarativePieSlice *at(int index); | |
64 | Q_INVOKABLE DeclarativePieSlice* find(QString label); |
|
63 | Q_INVOKABLE DeclarativePieSlice* find(QString label); | |
65 | Q_INVOKABLE DeclarativePieSlice* append(QString label, qreal value); |
|
64 | Q_INVOKABLE DeclarativePieSlice* append(QString label, qreal value); | |
66 |
|
65 | |||
67 | public: |
|
66 | public: | |
68 | void classBegin(); |
|
67 | void classBegin(); | |
69 | void componentComplete(); |
|
68 | void componentComplete(); | |
70 |
|
69 | |||
71 | public Q_SLOTS: |
|
70 | public Q_SLOTS: | |
72 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
71 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); | |
73 | }; |
|
72 | }; | |
74 |
|
73 | |||
75 | QTCOMMERCIALCHART_END_NAMESPACE |
|
74 | QTCOMMERCIALCHART_END_NAMESPACE | |
76 |
|
75 | |||
77 | #endif // DECLARATIVEPIESERIES_H |
|
76 | #endif // DECLARATIVEPIESERIES_H |
@@ -1,56 +1,57 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVESCATTERSERIES_H |
|
21 | #ifndef DECLARATIVESCATTERSERIES_H | |
22 | #define DECLARATIVESCATTERSERIES_H |
|
22 | #define DECLARATIVESCATTERSERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qscatterseries.h" |
|
25 | #include "qscatterseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
|
27 | #include <QDeclarativeListProperty> | |||
27 |
|
28 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
30 | |||
30 | class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries |
|
31 | class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries | |
31 | { |
|
32 | { | |
32 | Q_OBJECT |
|
33 | Q_OBJECT | |
33 | Q_PROPERTY(QColor color READ brushColor WRITE setBrushColor) |
|
34 | Q_PROPERTY(QColor color READ brushColor WRITE setBrushColor) | |
34 | Q_PROPERTY(QColor borderColor READ penColor WRITE setPenColor) |
|
35 | Q_PROPERTY(QColor borderColor READ penColor WRITE setPenColor) | |
35 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
36 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) | |
36 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
37 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") | |
37 |
|
38 | |||
38 | public: |
|
39 | public: | |
39 | explicit DeclarativeScatterSeries(QObject *parent = 0); |
|
40 | explicit DeclarativeScatterSeries(QObject *parent = 0); | |
40 | QDeclarativeListProperty<QObject> declarativeChildren(); |
|
41 | QDeclarativeListProperty<QObject> declarativeChildren(); | |
41 | QColor brushColor(); |
|
42 | QColor brushColor(); | |
42 | void setBrushColor(QColor color); |
|
43 | void setBrushColor(QColor color); | |
43 |
|
44 | |||
44 | public: // from QScatterSeries |
|
45 | public: // from QScatterSeries | |
45 | Q_INVOKABLE void append(qreal x, qreal y) { QScatterSeries::append(x, y); } |
|
46 | Q_INVOKABLE void append(qreal x, qreal y) { QScatterSeries::append(x, y); } | |
46 | Q_INVOKABLE void remove(qreal x, qreal y) { QScatterSeries::remove(x, y); } |
|
47 | Q_INVOKABLE void remove(qreal x, qreal y) { QScatterSeries::remove(x, y); } | |
47 | Q_INVOKABLE void clear() { QScatterSeries::removeAll(); } |
|
48 | Q_INVOKABLE void clear() { QScatterSeries::removeAll(); } | |
48 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } |
|
49 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } | |
49 |
|
50 | |||
50 | public Q_SLOTS: |
|
51 | public Q_SLOTS: | |
51 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
52 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); | |
52 | }; |
|
53 | }; | |
53 |
|
54 | |||
54 | QTCOMMERCIALCHART_END_NAMESPACE |
|
55 | QTCOMMERCIALCHART_END_NAMESPACE | |
55 |
|
56 | |||
56 | #endif // DECLARATIVESCATTERSERIES_H |
|
57 | #endif // DECLARATIVESCATTERSERIES_H |
@@ -1,54 +1,55 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVESPLINESERIES_H |
|
21 | #ifndef DECLARATIVESPLINESERIES_H | |
22 | #define DECLARATIVESPLINESERIES_H |
|
22 | #define DECLARATIVESPLINESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "qsplineseries.h" |
|
25 | #include "qsplineseries.h" | |
26 | #include "declarativexyseries.h" |
|
26 | #include "declarativexyseries.h" | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
|
28 | #include <QDeclarativeListProperty> | |||
28 |
|
29 | |||
29 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
30 |
|
31 | |||
31 | class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries |
|
32 | class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries | |
32 | { |
|
33 | { | |
33 | Q_OBJECT |
|
34 | Q_OBJECT | |
34 | Q_PROPERTY(QColor color READ penColor WRITE setPenColor) |
|
35 | Q_PROPERTY(QColor color READ penColor WRITE setPenColor) | |
35 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
36 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) | |
36 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
37 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") | |
37 |
|
38 | |||
38 | public: |
|
39 | public: | |
39 | explicit DeclarativeSplineSeries(QObject *parent = 0); |
|
40 | explicit DeclarativeSplineSeries(QObject *parent = 0); | |
40 | QDeclarativeListProperty<QObject> declarativeChildren(); |
|
41 | QDeclarativeListProperty<QObject> declarativeChildren(); | |
41 |
|
42 | |||
42 | public: // from QSplineSeries |
|
43 | public: // from QSplineSeries | |
43 | Q_INVOKABLE void append(qreal x, qreal y) { QSplineSeries::append(x, y); } |
|
44 | Q_INVOKABLE void append(qreal x, qreal y) { QSplineSeries::append(x, y); } | |
44 | Q_INVOKABLE void remove(qreal x, qreal y) { QSplineSeries::remove(x, y); } |
|
45 | Q_INVOKABLE void remove(qreal x, qreal y) { QSplineSeries::remove(x, y); } | |
45 | Q_INVOKABLE void clear() { QSplineSeries::removeAll(); } |
|
46 | Q_INVOKABLE void clear() { QSplineSeries::removeAll(); } | |
46 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } |
|
47 | Q_INVOKABLE DeclarativeXyPoint *at(int index) { return DeclarativeXySeries::at(index); } | |
47 |
|
48 | |||
48 | public Q_SLOTS: |
|
49 | public Q_SLOTS: | |
49 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
50 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); | |
50 | }; |
|
51 | }; | |
51 |
|
52 | |||
52 | QTCOMMERCIALCHART_END_NAMESPACE |
|
53 | QTCOMMERCIALCHART_END_NAMESPACE | |
53 |
|
54 | |||
54 | #endif // DECLARATIVESPLINESERIES_H |
|
55 | #endif // DECLARATIVESPLINESERIES_H |
@@ -1,47 +1,47 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVE_XY_SERIES_H |
|
21 | #ifndef DECLARATIVE_XY_SERIES_H | |
22 | #define DECLARATIVE_XY_SERIES_H |
|
22 | #define DECLARATIVE_XY_SERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "declarativexypoint.h" |
|
25 | #include "declarativexypoint.h" | |
26 | #include "declarativemodel.h" |
|
26 | #include <QColor> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | class QChart; |
|
30 | class QChart; | |
31 | class QAbstractSeries; |
|
31 | class QAbstractSeries; | |
32 |
|
32 | |||
33 | class DeclarativeXySeries |
|
33 | class DeclarativeXySeries | |
34 | { |
|
34 | { | |
35 | public: |
|
35 | public: | |
36 | explicit DeclarativeXySeries(); |
|
36 | explicit DeclarativeXySeries(); | |
37 | ~DeclarativeXySeries(); |
|
37 | ~DeclarativeXySeries(); | |
38 |
|
38 | |||
39 | public: |
|
39 | public: | |
40 | QColor penColor(); |
|
40 | QColor penColor(); | |
41 | void setPenColor(QColor color); |
|
41 | void setPenColor(QColor color); | |
42 | DeclarativeXyPoint *at(int index); |
|
42 | DeclarativeXyPoint *at(int index); | |
43 | }; |
|
43 | }; | |
44 |
|
44 | |||
45 | QTCOMMERCIALCHART_END_NAMESPACE |
|
45 | QTCOMMERCIALCHART_END_NAMESPACE | |
46 |
|
46 | |||
47 | #endif // DECLARATIVE_XY_SERIES_H |
|
47 | #endif // DECLARATIVE_XY_SERIES_H |
@@ -1,88 +1,85 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #include <QtDeclarative/qdeclarativeextensionplugin.h> |
|
21 | #include <QtDeclarative/qdeclarativeextensionplugin.h> | |
22 | #include <QtDeclarative/qdeclarative.h> |
|
22 | #include <QtDeclarative/qdeclarative.h> | |
23 | #include "qchart.h" |
|
23 | #include "qchart.h" | |
24 | #include "qaxiscategories.h" |
|
24 | #include "qaxiscategories.h" | |
25 | #include "declarativechart.h" |
|
25 | #include "declarativechart.h" | |
26 | #include "declarativexypoint.h" |
|
26 | #include "declarativexypoint.h" | |
27 | #include "declarativelineseries.h" |
|
27 | #include "declarativelineseries.h" | |
28 | #include "declarativesplineseries.h" |
|
28 | #include "declarativesplineseries.h" | |
29 | #include "declarativeareaseries.h" |
|
29 | #include "declarativeareaseries.h" | |
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 "declarativemodel.h" |
|
|||
34 | #include <QHPieModelMapper> |
|
33 | #include <QHPieModelMapper> | |
35 | #include <QVPieModelMapper> |
|
34 | #include <QVPieModelMapper> | |
36 | #include <QXYModelMapper> |
|
35 | #include <QXYModelMapper> | |
37 |
|
36 | |||
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
37 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
39 |
|
38 | |||
40 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin |
|
39 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin | |
41 | { |
|
40 | { | |
42 | Q_OBJECT |
|
41 | Q_OBJECT | |
43 | public: |
|
42 | public: | |
44 | virtual void registerTypes(const char *uri) |
|
43 | virtual void registerTypes(const char *uri) | |
45 | { |
|
44 | { | |
46 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
45 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); | |
47 |
|
46 | |||
48 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
47 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); | |
49 | qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint"); |
|
48 | qmlRegisterType<DeclarativeXyPoint>(uri, 1, 0, "XyPoint"); | |
50 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
49 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); | |
51 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
50 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); | |
52 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
51 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); | |
53 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
52 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); | |
54 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
53 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); | |
55 | qmlRegisterType<DeclarativeGroupedBarSeries>(uri, 1, 0, "GroupedBarSeries"); |
|
54 | qmlRegisterType<DeclarativeGroupedBarSeries>(uri, 1, 0, "GroupedBarSeries"); | |
56 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
55 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); | |
57 | qmlRegisterType<DeclarativePieSlice>(uri, 1, 0, "PieSlice"); |
|
56 | qmlRegisterType<DeclarativePieSlice>(uri, 1, 0, "PieSlice"); | |
58 | qmlRegisterType<DeclarativeTableModel>(uri, 1, 0, "ChartModel"); |
|
|||
59 | qmlRegisterType<DeclarativeTableModelElement>(uri, 1, 0, "ChartModelElement"); |
|
|||
60 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); |
|
57 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); | |
61 |
|
58 | |||
62 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", |
|
59 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", | |
63 | QLatin1String("Trying to create uncreatable: QPieSeries.")); |
|
60 | QLatin1String("Trying to create uncreatable: QPieSeries.")); | |
64 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", |
|
61 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", | |
65 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
62 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); | |
66 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
63 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", | |
67 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
64 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | |
68 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); |
|
65 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); | |
69 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
66 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); | |
70 |
|
67 | |||
71 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", |
|
68 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", | |
72 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
69 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); | |
73 | qmlRegisterUncreatableType<QAxis>(uri, 1, 0, "Axis", |
|
70 | qmlRegisterUncreatableType<QAxis>(uri, 1, 0, "Axis", | |
74 | QLatin1String("Trying to create uncreatable: Axis.")); |
|
71 | QLatin1String("Trying to create uncreatable: Axis.")); | |
75 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
72 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", | |
76 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
73 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); | |
77 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
74 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", | |
78 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
75 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); | |
79 | } |
|
76 | } | |
80 | }; |
|
77 | }; | |
81 |
|
78 | |||
82 | #include "plugin.moc" |
|
79 | #include "plugin.moc" | |
83 |
|
80 | |||
84 | QTCOMMERCIALCHART_END_NAMESPACE |
|
81 | QTCOMMERCIALCHART_END_NAMESPACE | |
85 |
|
82 | |||
86 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
83 | QTCOMMERCIALCHART_USE_NAMESPACE | |
87 |
|
84 | |||
88 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
|
85 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) |
@@ -1,237 +1,235 | |||||
1 | !include( ../config.pri ):error( "Couldn't find the config.pri file!" ) |
|
1 | !include( ../config.pri ):error( "Couldn't find the config.pri file!" ) | |
2 |
|
2 | |||
3 | ############################# BUILD CONFIG ###################################### |
|
3 | ############################# BUILD CONFIG ###################################### | |
4 |
|
4 | |||
5 | TARGET = $$LIBRARY_NAME |
|
5 | TARGET = $$LIBRARY_NAME | |
6 | DESTDIR = $$CHART_BUILD_LIB_DIR |
|
6 | DESTDIR = $$CHART_BUILD_LIB_DIR | |
7 | TEMPLATE = lib |
|
7 | TEMPLATE = lib | |
8 | QT = core gui |
|
8 | QT = core gui | |
9 | DEFINES += QTCOMMERCIALCHART_LIBRARY |
|
9 | DEFINES += QTCOMMERCIALCHART_LIBRARY | |
10 | win32:CONFIG += create_prl |
|
10 | win32:CONFIG += create_prl | |
11 | # treat warnings as errors |
|
11 | # treat warnings as errors | |
12 | win32-msvc*: { |
|
12 | win32-msvc*: { | |
13 | QMAKE_CXXFLAGS += /WX |
|
13 | QMAKE_CXXFLAGS += /WX | |
14 | } else { |
|
14 | } else { | |
15 | QMAKE_CXXFLAGS += -Werror |
|
15 | QMAKE_CXXFLAGS += -Werror | |
16 | } |
|
16 | } | |
17 |
|
17 | |||
18 | unix:{ |
|
18 | unix:{ | |
19 | QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
|
19 | QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden | |
20 | } |
|
20 | } | |
21 |
|
21 | |||
22 | ############################# DEPEDENCES ######################################## |
|
22 | ############################# DEPEDENCES ######################################## | |
23 |
|
23 | |||
24 | win32-msvc*: LIBS += User32.lib |
|
24 | win32-msvc*: LIBS += User32.lib | |
25 | LIBS -= -l$$LIBRARY_NAME |
|
25 | LIBS -= -l$$LIBRARY_NAME | |
26 | INCLUDEPATH += ../include . |
|
26 | INCLUDEPATH += ../include . | |
27 |
|
27 | |||
28 | ############################# SOURCES ########################################## |
|
28 | ############################# SOURCES ########################################## | |
29 |
|
29 | |||
30 | SOURCES += \ |
|
30 | SOURCES += \ | |
31 | $$PWD/chartdataset.cpp \ |
|
31 | $$PWD/chartdataset.cpp \ | |
32 | $$PWD/chartpresenter.cpp \ |
|
32 | $$PWD/chartpresenter.cpp \ | |
33 | $$PWD/charttheme.cpp \ |
|
33 | $$PWD/charttheme.cpp \ | |
34 | $$PWD/domain.cpp \ |
|
34 | $$PWD/domain.cpp \ | |
35 | $$PWD/qchart.cpp \ |
|
35 | $$PWD/qchart.cpp \ | |
36 | $$PWD/qchartview.cpp \ |
|
36 | $$PWD/qchartview.cpp \ | |
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 |
|
|||
42 | PRIVATE_HEADERS += \ |
|
41 | PRIVATE_HEADERS += \ | |
43 | $$PWD/chartdataset_p.h \ |
|
42 | $$PWD/chartdataset_p.h \ | |
44 | $$PWD/chartitem_p.h \ |
|
43 | $$PWD/chartitem_p.h \ | |
45 | $$PWD/chartpresenter_p.h \ |
|
44 | $$PWD/chartpresenter_p.h \ | |
46 | $$PWD/charttheme_p.h \ |
|
45 | $$PWD/charttheme_p.h \ | |
47 | $$PWD/domain_p.h \ |
|
46 | $$PWD/domain_p.h \ | |
48 | $$PWD/chartbackground_p.h \ |
|
47 | $$PWD/chartbackground_p.h \ | |
49 | $$PWD/chart_p.h \ |
|
48 | $$PWD/chart_p.h \ | |
50 | $$PWD/chartconfig_p.h \ |
|
49 | $$PWD/chartconfig_p.h \ | |
51 | $$PWD/qchart_p.h \ |
|
50 | $$PWD/qchart_p.h \ | |
52 | $$PWD/qchartview_p.h \ |
|
51 | $$PWD/qchartview_p.h \ | |
53 | $$PWD/scroller_p.h \ |
|
52 | $$PWD/scroller_p.h \ | |
54 |
$$PWD/qabstractseries_p.h |
|
53 | $$PWD/qabstractseries_p.h | |
55 | $$PWD/charttablemodel.h |
|
|||
56 | PUBLIC_HEADERS += \ |
|
54 | PUBLIC_HEADERS += \ | |
57 | $$PWD/qchart.h \ |
|
55 | $$PWD/qchart.h \ | |
58 | $$PWD/qchartglobal.h \ |
|
56 | $$PWD/qchartglobal.h \ | |
59 | $$PWD/qabstractseries.h \ |
|
57 | $$PWD/qabstractseries.h \ | |
60 | $$PWD/qchartview.h |
|
58 | $$PWD/qchartview.h | |
61 |
|
59 | |||
62 | include(animations/animations.pri) |
|
60 | include(animations/animations.pri) | |
63 | include(areachart/areachart.pri) |
|
61 | include(areachart/areachart.pri) | |
64 | include(axis/axis.pri) |
|
62 | include(axis/axis.pri) | |
65 | include(barchart/barchart.pri) |
|
63 | include(barchart/barchart.pri) | |
66 | include(legend/legend.pri) |
|
64 | include(legend/legend.pri) | |
67 | include(linechart/linechart.pri) |
|
65 | include(linechart/linechart.pri) | |
68 | include(piechart/piechart.pri) |
|
66 | include(piechart/piechart.pri) | |
69 | include(scatterchart/scatter.pri) |
|
67 | include(scatterchart/scatter.pri) | |
70 | include(splinechart/splinechart.pri) |
|
68 | include(splinechart/splinechart.pri) | |
71 | include(themes/themes.pri) |
|
69 | include(themes/themes.pri) | |
72 | include(xychart/xychart.pri) |
|
70 | include(xychart/xychart.pri) | |
73 |
|
71 | |||
74 | HEADERS += $$PUBLIC_HEADERS |
|
72 | HEADERS += $$PUBLIC_HEADERS | |
75 | HEADERS += $$PRIVATE_HEADERS |
|
73 | HEADERS += $$PRIVATE_HEADERS | |
76 | HEADERS += $$THEMES |
|
74 | HEADERS += $$THEMES | |
77 |
|
75 | |||
78 | ############################# BUILD PATH ########################################## |
|
76 | ############################# BUILD PATH ########################################## | |
79 |
|
77 | |||
80 | OBJECTS_DIR = $$CHART_BUILD_DIR/lib |
|
78 | OBJECTS_DIR = $$CHART_BUILD_DIR/lib | |
81 | MOC_DIR = $$CHART_BUILD_DIR/lib |
|
79 | MOC_DIR = $$CHART_BUILD_DIR/lib | |
82 | UI_DIR = $$CHART_BUILD_DIR/lib |
|
80 | UI_DIR = $$CHART_BUILD_DIR/lib | |
83 | RCC_DIR = $$CHART_BUILD_DIR/lib |
|
81 | RCC_DIR = $$CHART_BUILD_DIR/lib | |
84 |
|
82 | |||
85 | ############################# PUBLIC HEADERS GENERTOR ########################################## |
|
83 | ############################# PUBLIC HEADERS GENERTOR ########################################## | |
86 |
|
84 | |||
87 | #this is very primitive and lame parser , TODO: make perl script insted |
|
85 | #this is very primitive and lame parser , TODO: make perl script insted | |
88 | !exists($$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal) |
|
86 | !exists($$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal) | |
89 | { |
|
87 | { | |
90 | system($$QMAKE_MKDIR $$CHART_BUILD_PUBLIC_HEADER_DIR) |
|
88 | system($$QMAKE_MKDIR $$CHART_BUILD_PUBLIC_HEADER_DIR) | |
91 | win32:{ |
|
89 | win32:{ | |
92 | command = "echo $${LITERAL_HASH}include \"qchartglobal.h\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" |
|
90 | command = "echo $${LITERAL_HASH}include \"qchartglobal.h\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" | |
93 | }else{ |
|
91 | }else{ | |
94 | command = "echo \"$${LITERAL_HASH}include \\\"qchartglobal.h\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" |
|
92 | command = "echo \"$${LITERAL_HASH}include \\\"qchartglobal.h\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" | |
95 | } |
|
93 | } | |
96 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal |
|
94 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal | |
97 | system($$command) |
|
95 | system($$command) | |
98 | } |
|
96 | } | |
99 |
|
97 | |||
100 | for(file, PUBLIC_HEADERS) { |
|
98 | for(file, PUBLIC_HEADERS) { | |
101 | name = $$split(file,'/') |
|
99 | name = $$split(file,'/') | |
102 | name = $$last(name) |
|
100 | name = $$last(name) | |
103 | class = "$$cat($$file)" |
|
101 | class = "$$cat($$file)" | |
104 | class = $$find(class,class) |
|
102 | class = $$find(class,class) | |
105 | !isEmpty(class){ |
|
103 | !isEmpty(class){ | |
106 | class = $$split(class,QTCOMMERCIALCHART_EXPORT) |
|
104 | class = $$split(class,QTCOMMERCIALCHART_EXPORT) | |
107 | class = $$member(class,1) |
|
105 | class = $$member(class,1) | |
108 | class = $$split(class,' ') |
|
106 | class = $$split(class,' ') | |
109 | class = $$replace(class,' ','') |
|
107 | class = $$replace(class,' ','') | |
110 | class = $$member(class,0) |
|
108 | class = $$member(class,0) | |
111 | win32:{ |
|
109 | win32:{ | |
112 | command = "echo $${LITERAL_HASH}include \"$$name\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" |
|
110 | command = "echo $${LITERAL_HASH}include \"$$name\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" | |
113 | }else{ |
|
111 | }else{ | |
114 | command = "echo \"$${LITERAL_HASH}include \\\"$$name\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" |
|
112 | command = "echo \"$${LITERAL_HASH}include \\\"$$name\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" | |
115 | } |
|
113 | } | |
116 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class |
|
114 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class | |
117 | system($$command) |
|
115 | system($$command) | |
118 | } |
|
116 | } | |
119 | } |
|
117 | } | |
120 |
|
118 | |||
121 | ############################# INSTALLERS ########################################## |
|
119 | ############################# INSTALLERS ########################################## | |
122 |
|
120 | |||
123 | public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart |
|
121 | public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart | |
124 | public_headers.files = $$PUBLIC_HEADERS $$PUBLIC_QT_HEADERS |
|
122 | public_headers.files = $$PUBLIC_HEADERS $$PUBLIC_QT_HEADERS | |
125 | INSTALLS += public_headers |
|
123 | INSTALLS += public_headers | |
126 |
|
124 | |||
127 | install_build_public_headers.name = build_public_headers |
|
125 | install_build_public_headers.name = build_public_headers | |
128 | install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
126 | install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h | |
129 | install_build_public_headers.input = PUBLIC_HEADERS |
|
127 | install_build_public_headers.input = PUBLIC_HEADERS | |
130 | install_build_public_headers.commands = $$QMAKE_COPY \ |
|
128 | install_build_public_headers.commands = $$QMAKE_COPY \ | |
131 | ${QMAKE_FILE_NAME} \ |
|
129 | ${QMAKE_FILE_NAME} \ | |
132 | $$CHART_BUILD_PUBLIC_HEADER_DIR |
|
130 | $$CHART_BUILD_PUBLIC_HEADER_DIR | |
133 | install_build_public_headers.CONFIG += target_predeps \ |
|
131 | install_build_public_headers.CONFIG += target_predeps \ | |
134 | no_link |
|
132 | no_link | |
135 |
|
133 | |||
136 | install_build_private_headers.name = buld_private_headers |
|
134 | install_build_private_headers.name = buld_private_headers | |
137 | install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
135 | install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h | |
138 | install_build_private_headers.input = PRIVATE_HEADERS |
|
136 | install_build_private_headers.input = PRIVATE_HEADERS | |
139 | install_build_private_headers.commands = $$QMAKE_COPY \ |
|
137 | install_build_private_headers.commands = $$QMAKE_COPY \ | |
140 | ${QMAKE_FILE_NAME} \ |
|
138 | ${QMAKE_FILE_NAME} \ | |
141 | $$CHART_BUILD_PRIVATE_HEADER_DIR |
|
139 | $$CHART_BUILD_PRIVATE_HEADER_DIR | |
142 | install_build_private_headers.CONFIG += target_predeps \ |
|
140 | install_build_private_headers.CONFIG += target_predeps \ | |
143 | no_link |
|
141 | no_link | |
144 |
|
142 | |||
145 | QMAKE_EXTRA_COMPILERS += install_build_public_headers \ |
|
143 | QMAKE_EXTRA_COMPILERS += install_build_public_headers \ | |
146 | install_build_private_headers \ |
|
144 | install_build_private_headers \ | |
147 |
|
145 | |||
148 | win32:{ |
|
146 | win32:{ | |
149 | bintarget.CONFIG += no_check_exist |
|
147 | bintarget.CONFIG += no_check_exist | |
150 | bintarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.dll |
|
148 | bintarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.dll | |
151 | win32-msvc*:CONFIG(debug, debug|release): { |
|
149 | win32-msvc*:CONFIG(debug, debug|release): { | |
152 | bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.pdb |
|
150 | bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.pdb | |
153 | } |
|
151 | } | |
154 | bintarget.path = $$[QT_INSTALL_BINS] |
|
152 | bintarget.path = $$[QT_INSTALL_BINS] | |
155 |
|
153 | |||
156 | libtarget.CONFIG += no_check_exist |
|
154 | libtarget.CONFIG += no_check_exist | |
157 | libtarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.prl |
|
155 | libtarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.prl | |
158 | win32-msvc*: { |
|
156 | win32-msvc*: { | |
159 | libtarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.lib |
|
157 | libtarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.lib | |
160 | } else { |
|
158 | } else { | |
161 | libtarget.files += $$CHART_BUILD_LIB_DIR\\lib$${TARGET}.a |
|
159 | libtarget.files += $$CHART_BUILD_LIB_DIR\\lib$${TARGET}.a | |
162 | } |
|
160 | } | |
163 | libtarget.path = $$[QT_INSTALL_LIBS] |
|
161 | libtarget.path = $$[QT_INSTALL_LIBS] | |
164 |
|
162 | |||
165 | DLLDESTDIR = $$CHART_BUILD_BIN_DIR |
|
163 | DLLDESTDIR = $$CHART_BUILD_BIN_DIR | |
166 | INSTALLS += bintarget libtarget |
|
164 | INSTALLS += bintarget libtarget | |
167 | }else{ |
|
165 | }else{ | |
168 | target.path=$$[QT_INSTALL_LIBS] |
|
166 | target.path=$$[QT_INSTALL_LIBS] | |
169 | INSTALLS += target |
|
167 | INSTALLS += target | |
170 | } |
|
168 | } | |
171 | ################################ DEVELOPMENT BUILD ########################################## |
|
169 | ################################ DEVELOPMENT BUILD ########################################## | |
172 | # There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. |
|
170 | # There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. | |
173 | # This is the case at least with shadow builds. |
|
171 | # This is the case at least with shadow builds. | |
174 | # http://qt-project.org/wiki/jom |
|
172 | # http://qt-project.org/wiki/jom | |
175 |
|
173 | |||
176 | development_build:!win32-msvc*:{ |
|
174 | development_build:!win32-msvc*:{ | |
177 | chartversion.target = $$PWD/qchartversion_p.h |
|
175 | chartversion.target = $$PWD/qchartversion_p.h | |
178 |
|
176 | |||
179 | unix:{ |
|
177 | unix:{ | |
180 | chartversion.commands = @echo \ |
|
178 | chartversion.commands = @echo \ | |
181 | \" $${LITERAL_HASH}ifndef QCHARTVERSION_P_H\\n\ |
|
179 | \" $${LITERAL_HASH}ifndef QCHARTVERSION_P_H\\n\ | |
182 | $${LITERAL_HASH}define QCHARTVERSION_P_H\\n\ |
|
180 | $${LITERAL_HASH}define QCHARTVERSION_P_H\\n\ | |
183 | const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" ; \\n\ |
|
181 | const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" ; \\n\ | |
184 | const char *gitHead = \\\"`git rev-parse HEAD`\\\" ; \\n \ |
|
182 | const char *gitHead = \\\"`git rev-parse HEAD`\\\" ; \\n \ | |
185 | $${LITERAL_HASH}endif \" \ |
|
183 | $${LITERAL_HASH}endif \" \ | |
186 | > \ |
|
184 | > \ | |
187 | $$chartversion.target; |
|
185 | $$chartversion.target; | |
188 | }else{ |
|
186 | }else{ | |
189 | chartversion.commands = @echo \ |
|
187 | chartversion.commands = @echo \ | |
190 | "const char *buildTime = \"%date%_%time%\" ; \ |
|
188 | "const char *buildTime = \"%date%_%time%\" ; \ | |
191 | const char *gitHead = \"unknown\" ; " \ |
|
189 | const char *gitHead = \"unknown\" ; " \ | |
192 | > \ |
|
190 | > \ | |
193 | $$chartversion.target |
|
191 | $$chartversion.target | |
194 | } |
|
192 | } | |
195 |
|
193 | |||
196 | chartversion.depends = $$HEADERS \ |
|
194 | chartversion.depends = $$HEADERS \ | |
197 | $$SOURCES |
|
195 | $$SOURCES | |
198 |
|
196 | |||
199 | PRE_TARGETDEPS += $$chartversion.target |
|
197 | PRE_TARGETDEPS += $$chartversion.target | |
200 | QMAKE_CLEAN += $$PWD/qchartversion_p.h |
|
198 | QMAKE_CLEAN += $$PWD/qchartversion_p.h | |
201 | QMAKE_EXTRA_TARGETS += chartversion |
|
199 | QMAKE_EXTRA_TARGETS += chartversion | |
202 | } |
|
200 | } | |
203 |
|
201 | |||
204 | ############################### CLEAN ########################################### |
|
202 | ############################### CLEAN ########################################### | |
205 |
|
203 | |||
206 | unix:QMAKE_DISTCLEAN += -r \ |
|
204 | unix:QMAKE_DISTCLEAN += -r \ | |
207 | $$CHART_BUILD_HEADER_DIR \ |
|
205 | $$CHART_BUILD_HEADER_DIR \ | |
208 | $$CHART_BUILD_LIB_DIR |
|
206 | $$CHART_BUILD_LIB_DIR | |
209 | win32:QMAKE_DISTCLEAN += /Q \ |
|
207 | win32:QMAKE_DISTCLEAN += /Q \ | |
210 | $$CHART_BUILD_HEADER_DIR \ |
|
208 | $$CHART_BUILD_HEADER_DIR \ | |
211 | $$CHART_BUILD_LIB_DIR |
|
209 | $$CHART_BUILD_LIB_DIR | |
212 |
|
210 | |||
213 | ############################## COVERAGE ######################################### |
|
211 | ############################## COVERAGE ######################################### | |
214 |
|
212 | |||
215 | unix:coverage:{ |
|
213 | unix:coverage:{ | |
216 |
|
214 | |||
217 | QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage |
|
215 | QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage | |
218 | QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage |
|
216 | QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage | |
219 |
|
217 | |||
220 | LIBS += -lgcov |
|
218 | LIBS += -lgcov | |
221 |
|
219 | |||
222 | QMAKE_CLEAN += $$OBJECTS_DIR/*.gcda $$OBJECTS_DIR/*.gcno $$PWD/*.gcov ../coverage/*.info |
|
220 | QMAKE_CLEAN += $$OBJECTS_DIR/*.gcda $$OBJECTS_DIR/*.gcno $$PWD/*.gcov ../coverage/*.info | |
223 | QMAKE_EXTRA_TARGETS += preparecoverage gencoverage |
|
221 | QMAKE_EXTRA_TARGETS += preparecoverage gencoverage | |
224 |
|
222 | |||
225 | preparecoverage.target = prepare_coverage |
|
223 | preparecoverage.target = prepare_coverage | |
226 | preparecoverage.depends = all |
|
224 | preparecoverage.depends = all | |
227 | preparecoverage.commands = lcov --directory $$OBJECTS_DIR --zerocounters ;\ |
|
225 | preparecoverage.commands = lcov --directory $$OBJECTS_DIR --zerocounters ;\ | |
228 | lcov -i -d $$OBJECTS_DIR -c -o ../coverage/base.info -b $$PWD; |
|
226 | lcov -i -d $$OBJECTS_DIR -c -o ../coverage/base.info -b $$PWD; | |
229 |
|
227 | |||
230 | gencoverage.target = gen_coverage |
|
228 | gencoverage.target = gen_coverage | |
231 | gencoverage.depends = all |
|
229 | gencoverage.depends = all | |
232 | gencoverage.commands = lcov -d $$OBJECTS_DIR -c -o ../coverage/src.info -b $$PWD;\ |
|
230 | gencoverage.commands = lcov -d $$OBJECTS_DIR -c -o ../coverage/src.info -b $$PWD;\ | |
233 | lcov -e ../coverage/base.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/base.info;\ |
|
231 | lcov -e ../coverage/base.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/base.info;\ | |
234 | lcov -e ../coverage/src.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/src.info;\ |
|
232 | lcov -e ../coverage/src.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/src.info;\ | |
235 | lcov -a ../coverage/base.info -a ../coverage/src.info -o ../coverage/coverage.info; |
|
233 | lcov -a ../coverage/base.info -a ../coverage/src.info -o ../coverage/coverage.info; | |
236 | } |
|
234 | } | |
237 |
|
235 |
General Comments 0
You need to be logged in to leave comments.
Login now