##// END OF EJS Templates
Minor fix: Unused parameter warning
Marek Rosa -
r1253:c7489d5d3599
parent child
Show More
@@ -1,112 +1,114
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 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26
26
27
27
28 ////////////// Table model row ///////////////////
28 ////////////// Table model row ///////////////////
29
29
30 DeclarativeTableModelElement::DeclarativeTableModelElement(QObject *parent)
30 DeclarativeTableModelElement::DeclarativeTableModelElement(QObject *parent)
31 : QObject(parent)
31 : QObject(parent)
32 {
32 {
33 }
33 }
34
34
35 QVariantList DeclarativeTableModelElement::values()
35 QVariantList DeclarativeTableModelElement::values()
36 {
36 {
37 return m_values;
37 return m_values;
38 }
38 }
39
39
40 void DeclarativeTableModelElement::setValues(QVariantList values)
40 void DeclarativeTableModelElement::setValues(QVariantList values)
41 {
41 {
42 m_values = values;
42 m_values = values;
43 }
43 }
44
44
45 ////////////// Table model ///////////////////
45 ////////////// Table model ///////////////////
46
46
47 DeclarativeTableModel::DeclarativeTableModel(QObject *parent) :
47 DeclarativeTableModel::DeclarativeTableModel(QObject *parent) :
48 ChartTableModel(parent)
48 ChartTableModel(parent)
49 {
49 {
50 }
50 }
51
51
52 void DeclarativeTableModel::classBegin()
52 void DeclarativeTableModel::classBegin()
53 {
53 {
54 }
54 }
55
55
56 void DeclarativeTableModel::componentComplete()
56 void DeclarativeTableModel::componentComplete()
57 {
57 {
58 foreach (QObject *child, children()) {
58 foreach (QObject *child, children()) {
59 if (qobject_cast<DeclarativeTableModelElement *>(child)) {
59 if (qobject_cast<DeclarativeTableModelElement *>(child)) {
60 append(qobject_cast<DeclarativeTableModelElement *>(child)->values());
60 append(qobject_cast<DeclarativeTableModelElement *>(child)->values());
61 }
61 }
62 }
62 }
63 }
63 }
64
64
65 QDeclarativeListProperty<QObject> DeclarativeTableModel::modelChildren()
65 QDeclarativeListProperty<QObject> DeclarativeTableModel::modelChildren()
66 {
66 {
67 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeTableModel::appendModelChild);
67 return QDeclarativeListProperty<QObject>(this, 0, &DeclarativeTableModel::appendModelChild);
68 }
68 }
69
69
70 void DeclarativeTableModel::appendModelChild(QDeclarativeListProperty<QObject> *list,
70 void DeclarativeTableModel::appendModelChild(QDeclarativeListProperty<QObject> *list,
71 QObject *child)
71 QObject *child)
72 {
72 {
73 // childs are added in componentComplete instead
73 // childs are added in componentComplete instead
74 Q_UNUSED(list)
74 Q_UNUSED(list)
75 Q_UNUSED(child)
75 Q_UNUSED(child)
76 }
76 }
77
77
78 void DeclarativeTableModel::append(QVariantList values)
78 void DeclarativeTableModel::append(QVariantList values)
79 {
79 {
80 // qDebug() << "DeclarativeTableModel::append:" << values;
80 // qDebug() << "DeclarativeTableModel::append:" << values;
81
81
82 while (columnCount() < values.count())
82 while (columnCount() < values.count())
83 insertColumn(columnCount());
83 insertColumn(columnCount());
84
84
85 insertRow(rowCount());
85 insertRow(rowCount());
86
86
87 QModelIndex beginIndex = QModelIndex();
87 QModelIndex beginIndex = QModelIndex();
88 QModelIndex endIndex = QModelIndex();
88 QModelIndex endIndex = QModelIndex();
89 for (int i(0); i < values.count(); i++) {
89 for (int i(0); i < values.count(); i++) {
90 QModelIndex modelIndex = createIndex(rowCount() - 1, i);
90 QModelIndex modelIndex = createIndex(rowCount() - 1, i);
91 if (i == 0)
91 if (i == 0)
92 beginIndex = modelIndex;
92 beginIndex = modelIndex;
93 if (i == (values.count() - 1))
93 if (i == (values.count() - 1))
94 endIndex = modelIndex;
94 endIndex = modelIndex;
95 setData(modelIndex, values.at(i));
95 setData(modelIndex, values.at(i));
96 }
96 }
97 dataChanged(beginIndex, endIndex);
97 dataChanged(beginIndex, endIndex);
98 }
98 }
99
99
100 void DeclarativeTableModel::appendPoint(QXYModelMapper *mapper, DeclarativeXyPoint *point)
100 void DeclarativeTableModel::appendPoint(QXYModelMapper *mapper, DeclarativeXyPoint *point)
101 {
101 {
102 // qDebug() << "DeclarativeTableModel::appendPoint:" << point;
102 Q_UNUSED(mapper)
103 QVariantList values;
103 Q_UNUSED(point)
104 // TODO: XYModelMapper implementation has change, this code has to be updated.
104 // TODO: XYModelMapper implementation has change, this code has to be updated.
105 // qDebug() << "DeclarativeTableModel::appendPoint:" << point;
106 // QVariantList values;
105 // values.insert(mapper->mapX(), point->x());
107 // values.insert(mapper->mapX(), point->x());
106 // values.insert(mapper->mapY(), point->y());
108 // values.insert(mapper->mapY(), point->y());
107 append(values);
109 // append(values);
108 }
110 }
109
111
110 #include "moc_declarativemodel.cpp"
112 #include "moc_declarativemodel.cpp"
111
113
112 QTCOMMERCIALCHART_END_NAMESPACE
114 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now