@@ -101,29 +101,29 void QBarModelMapper::setOrientation(Qt::Orientation orientation) | |||||
101 | d->initializeBarFromModel(); |
|
101 | d->initializeBarFromModel(); | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
104 | int QBarModelMapper::firstBarSection() const |
|
104 | int QBarModelMapper::firstBarSetSection() const | |
105 | { |
|
105 | { | |
106 | Q_D(const QBarModelMapper); |
|
106 | Q_D(const QBarModelMapper); | |
107 | return d->m_firstBarSection; |
|
107 | return d->m_firstBarSetSection; | |
108 | } |
|
108 | } | |
109 |
|
109 | |||
110 | void QBarModelMapper::setFirstBarSection(int firstBarSection) |
|
110 | void QBarModelMapper::setFirstBarSetSection(int firstBarSetSection) | |
111 | { |
|
111 | { | |
112 | Q_D(QBarModelMapper); |
|
112 | Q_D(QBarModelMapper); | |
113 | d->m_firstBarSection = firstBarSection; |
|
113 | d->m_firstBarSetSection = firstBarSetSection; | |
114 | d->initializeBarFromModel(); |
|
114 | d->initializeBarFromModel(); | |
115 | } |
|
115 | } | |
116 |
|
116 | |||
117 | int QBarModelMapper::lastBarSection() const |
|
117 | int QBarModelMapper::lastBarSetSection() const | |
118 | { |
|
118 | { | |
119 | Q_D(const QBarModelMapper); |
|
119 | Q_D(const QBarModelMapper); | |
120 | return d->m_lastBarSection; |
|
120 | return d->m_lastBarSetSection; | |
121 | } |
|
121 | } | |
122 |
|
122 | |||
123 | void QBarModelMapper::setLastBarSection(int lastBarSection) |
|
123 | void QBarModelMapper::setLastBarSetSection(int lastBarSetSection) | |
124 | { |
|
124 | { | |
125 | Q_D(QBarModelMapper); |
|
125 | Q_D(QBarModelMapper); | |
126 | d->m_lastBarSection = lastBarSection; |
|
126 | d->m_lastBarSetSection = lastBarSetSection; | |
127 | d->initializeBarFromModel(); |
|
127 | d->initializeBarFromModel(); | |
128 | } |
|
128 | } | |
129 |
|
129 | |||
@@ -146,8 +146,8 void QBarModelMapper::reset() | |||||
146 | d->m_first = 0; |
|
146 | d->m_first = 0; | |
147 | d->m_count = -1; |
|
147 | d->m_count = -1; | |
148 | d->m_orientation = Qt::Vertical; |
|
148 | d->m_orientation = Qt::Vertical; | |
149 | d->m_firstBarSection = -1; |
|
149 | d->m_firstBarSetSection = -1; | |
150 | d->m_lastBarSection = -1; |
|
150 | d->m_lastBarSetSection = -1; | |
151 | d->m_categoriesSection = -1; |
|
151 | d->m_categoriesSection = -1; | |
152 | d->initializeBarFromModel(); |
|
152 | d->initializeBarFromModel(); | |
153 | } |
|
153 | } | |
@@ -160,8 +160,8 QBarModelMapperPrivate::QBarModelMapperPrivate(QBarModelMapper *q) : | |||||
160 | m_first(0), |
|
160 | m_first(0), | |
161 | m_count(-1), |
|
161 | m_count(-1), | |
162 | m_orientation(Qt::Vertical), |
|
162 | m_orientation(Qt::Vertical), | |
163 | m_firstBarSection(-1), |
|
163 | m_firstBarSetSection(-1), | |
164 | m_lastBarSection(-1), |
|
164 | m_lastBarSetSection(-1), | |
165 | m_categoriesSection(-1), |
|
165 | m_categoriesSection(-1), | |
166 | m_seriesSignalsBlock(false), |
|
166 | m_seriesSignalsBlock(false), | |
167 | m_modelSignalsBlock(false), |
|
167 | m_modelSignalsBlock(false), | |
@@ -184,12 +184,12 QBarSet* QBarModelMapperPrivate::barSet(QModelIndex index) | |||||
184 | if (!index.isValid()) |
|
184 | if (!index.isValid()) | |
185 | return 0; |
|
185 | return 0; | |
186 |
|
186 | |||
187 | if (m_orientation == Qt::Vertical && index.column() >= m_firstBarSection && index.column() <= m_lastBarSection) { |
|
187 | if (m_orientation == Qt::Vertical && index.column() >= m_firstBarSetSection && index.column() <= m_lastBarSetSection) { | |
188 | if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) |
|
188 | if (index.row() >= m_first && (m_count == - 1 || index.row() < m_first + m_count)) | |
189 | return m_series->barSets().at(index.column() - m_firstBarSection); |
|
189 | return m_series->barSets().at(index.column() - m_firstBarSetSection); | |
190 | } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBarSection && index.row() <= m_lastBarSection) { |
|
190 | } else if (m_orientation == Qt::Horizontal && index.row() >= m_firstBarSetSection && index.row() <= m_lastBarSetSection) { | |
191 | if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) |
|
191 | if (index.column() >= m_first && (m_count == - 1 || index.column() < m_first + m_count)) | |
192 | return m_series->barSets().at(index.row() - m_firstBarSection); |
|
192 | return m_series->barSets().at(index.row() - m_firstBarSetSection); | |
193 | } |
|
193 | } | |
194 | return 0; // This part of model has not been mapped to any slice |
|
194 | return 0; // This part of model has not been mapped to any slice | |
195 | } |
|
195 | } | |
@@ -199,7 +199,7 QModelIndex QBarModelMapperPrivate::barModelIndex(int barSection, int posInBar) | |||||
199 | if (m_count != -1 && posInBar >= m_count) |
|
199 | if (m_count != -1 && posInBar >= m_count) | |
200 | return QModelIndex(); // invalid |
|
200 | return QModelIndex(); // invalid | |
201 |
|
201 | |||
202 | if (barSection < m_firstBarSection || barSection > m_lastBarSection) |
|
202 | if (barSection < m_firstBarSetSection || barSection > m_lastBarSetSection) | |
203 | return QModelIndex(); // invalid |
|
203 | return QModelIndex(); // invalid | |
204 |
|
204 | |||
205 | if (m_orientation == Qt::Vertical) |
|
205 | if (m_orientation == Qt::Vertical) | |
@@ -260,7 +260,7 void QBarModelMapperPrivate::modelRowsAdded(QModelIndex parent, int start, int e | |||||
260 | if (m_orientation == Qt::Vertical) |
|
260 | if (m_orientation == Qt::Vertical) | |
261 | // insertData(start, end); |
|
261 | // insertData(start, end); | |
262 | initializeBarFromModel(); |
|
262 | initializeBarFromModel(); | |
263 | else if (start <= m_firstBarSection || start <= m_lastBarSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize |
|
263 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize | |
264 | initializeBarFromModel(); |
|
264 | initializeBarFromModel(); | |
265 | blockSeriesSignals(false); |
|
265 | blockSeriesSignals(false); | |
266 | } |
|
266 | } | |
@@ -276,7 +276,7 void QBarModelMapperPrivate::modelRowsRemoved(QModelIndex parent, int start, int | |||||
276 | if (m_orientation == Qt::Vertical) |
|
276 | if (m_orientation == Qt::Vertical) | |
277 | // removeData(start, end); |
|
277 | // removeData(start, end); | |
278 | initializeBarFromModel(); |
|
278 | initializeBarFromModel(); | |
279 | else if (start <= m_firstBarSection || start <= m_lastBarSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize |
|
279 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize | |
280 | initializeBarFromModel(); |
|
280 | initializeBarFromModel(); | |
281 | blockSeriesSignals(false); |
|
281 | blockSeriesSignals(false); | |
282 | } |
|
282 | } | |
@@ -292,7 +292,7 void QBarModelMapperPrivate::modelColumnsAdded(QModelIndex parent, int start, in | |||||
292 | if (m_orientation == Qt::Horizontal) |
|
292 | if (m_orientation == Qt::Horizontal) | |
293 | // insertData(start, end); |
|
293 | // insertData(start, end); | |
294 | initializeBarFromModel(); |
|
294 | initializeBarFromModel(); | |
295 | else if (start <= m_firstBarSection || start <= m_lastBarSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize |
|
295 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize | |
296 | initializeBarFromModel(); |
|
296 | initializeBarFromModel(); | |
297 | blockSeriesSignals(false); |
|
297 | blockSeriesSignals(false); | |
298 | } |
|
298 | } | |
@@ -308,7 +308,7 void QBarModelMapperPrivate::modelColumnsRemoved(QModelIndex parent, int start, | |||||
308 | if (m_orientation == Qt::Horizontal) |
|
308 | if (m_orientation == Qt::Horizontal) | |
309 | // removeData(start, end); |
|
309 | // removeData(start, end); | |
310 | initializeBarFromModel(); |
|
310 | initializeBarFromModel(); | |
311 | else if (start <= m_firstBarSection || start <= m_lastBarSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize |
|
311 | else if (start <= m_firstBarSetSection || start <= m_lastBarSetSection || start <= m_categoriesSection) // if the changes affect the map - reinitialize | |
312 | initializeBarFromModel(); |
|
312 | initializeBarFromModel(); | |
313 | blockSeriesSignals(false); |
|
313 | blockSeriesSignals(false); | |
314 | } |
|
314 | } | |
@@ -390,7 +390,7 void QBarModelMapperPrivate::initializeBarFromModel() | |||||
390 | m_series->clear(); |
|
390 | m_series->clear(); | |
391 |
|
391 | |||
392 | // create the initial bar sets |
|
392 | // create the initial bar sets | |
393 | for (int i = m_firstBarSection; i <= m_lastBarSection; i++) { |
|
393 | for (int i = m_firstBarSetSection; i <= m_lastBarSetSection; i++) { | |
394 | int posInBar = 0; |
|
394 | int posInBar = 0; | |
395 | QModelIndex barIndex = barModelIndex(i, posInBar); |
|
395 | QModelIndex barIndex = barModelIndex(i, posInBar); | |
396 | QBarSet *barSet = new QBarSet(m_model->headerData(i, Qt::Horizontal).toString()); |
|
396 | QBarSet *barSet = new QBarSet(m_model->headerData(i, Qt::Horizontal).toString()); |
@@ -36,11 +36,11 public: | |||||
36 | int count() const; |
|
36 | int count() const; | |
37 | void setCount(int count); |
|
37 | void setCount(int count); | |
38 |
|
38 | |||
39 | int firstBarSection() const; |
|
39 | int firstBarSetSection() const; | |
40 | void setFirstBarSection(int firstBarSection); |
|
40 | void setFirstBarSetSection(int firstBarSetSection); | |
41 |
|
41 | |||
42 | int lastBarSection() const; |
|
42 | int lastBarSetSection() const; | |
43 | void setLastBarSection(int lastBarSection); |
|
43 | void setLastBarSetSection(int lastBarSetSection); | |
44 |
|
44 | |||
45 | int categoriesSection() const; |
|
45 | int categoriesSection() const; | |
46 | void setCategoriesSection(int categoriesSection); |
|
46 | void setCategoriesSection(int categoriesSection); |
@@ -47,8 +47,8 private: | |||||
47 | int m_first; |
|
47 | int m_first; | |
48 | int m_count; |
|
48 | int m_count; | |
49 | Qt::Orientation m_orientation; |
|
49 | Qt::Orientation m_orientation; | |
50 | int m_firstBarSection; |
|
50 | int m_firstBarSetSection; | |
51 | int m_lastBarSection; |
|
51 | int m_lastBarSetSection; | |
52 | int m_categoriesSection; |
|
52 | int m_categoriesSection; | |
53 | bool m_seriesSignalsBlock; |
|
53 | bool m_seriesSignalsBlock; | |
54 | bool m_modelSignalsBlock; |
|
54 | bool m_modelSignalsBlock; |
@@ -8,24 +8,24 QHBarModelMapper::QHBarModelMapper(QObject *parent) : | |||||
8 | QBarModelMapper::setOrientation(Qt::Horizontal); |
|
8 | QBarModelMapper::setOrientation(Qt::Horizontal); | |
9 | } |
|
9 | } | |
10 |
|
10 | |||
11 | int QHBarModelMapper::firstBarRow() const |
|
11 | int QHBarModelMapper::firstBarSetRow() const | |
12 | { |
|
12 | { | |
13 | return QBarModelMapper::firstBarSection(); |
|
13 | return QBarModelMapper::firstBarSetSection(); | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | void QHBarModelMapper::setFirstBarRow(int firstBarRow) |
|
16 | void QHBarModelMapper::setFirstBarSetRow(int firstBarSetRow) | |
17 | { |
|
17 | { | |
18 | return QBarModelMapper::setFirstBarSection(firstBarRow); |
|
18 | return QBarModelMapper::setFirstBarSetSection(firstBarSetRow); | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | int QHBarModelMapper::lastBarRow() const |
|
21 | int QHBarModelMapper::lastBarSetRow() const | |
22 | { |
|
22 | { | |
23 | return QBarModelMapper::lastBarSection(); |
|
23 | return QBarModelMapper::lastBarSetSection(); | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | void QHBarModelMapper::setLastBarRow(int lastBarRow) |
|
26 | void QHBarModelMapper::setLastBarSetRow(int lastBarSetRow) | |
27 | { |
|
27 | { | |
28 | return QBarModelMapper::setLastBarSection(lastBarRow); |
|
28 | return QBarModelMapper::setLastBarSetSection(lastBarSetRow); | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 | int QHBarModelMapper::categoriesRow() const |
|
31 | int QHBarModelMapper::categoriesRow() const |
@@ -8,17 +8,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
8 | class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper |
|
8 | class QTCOMMERCIALCHART_EXPORT QHBarModelMapper : public QBarModelMapper | |
9 | { |
|
9 | { | |
10 | Q_OBJECT |
|
10 | Q_OBJECT | |
11 | Q_PROPERTY(int firstBarRow READ firstBarRow WRITE setFirstBarRow) |
|
11 | Q_PROPERTY(int firstBarSetRow READ firstBarSetRow WRITE setFirstBarSetRow) | |
12 | Q_PROPERTY(int lastBarRow READ lastBarRow WRITE setLastBarRow) |
|
12 | Q_PROPERTY(int lastBarSetRow READ lastBarSetRow WRITE setLastBarSetRow) | |
13 |
|
13 | |||
14 | public: |
|
14 | public: | |
15 | explicit QHBarModelMapper(QObject *parent = 0); |
|
15 | explicit QHBarModelMapper(QObject *parent = 0); | |
16 |
|
16 | |||
17 | int firstBarRow() const; |
|
17 | int firstBarSetRow() const; | |
18 | void setFirstBarRow(int firstBarRow); |
|
18 | void setFirstBarSetRow(int firstBarSetRow); | |
19 |
|
19 | |||
20 | int lastBarRow() const; |
|
20 | int lastBarSetRow() const; | |
21 | void setLastBarRow(int lastBarRow); |
|
21 | void setLastBarSetRow(int lastBarSetRow); | |
22 |
|
22 | |||
23 | int categoriesRow() const; |
|
23 | int categoriesRow() const; | |
24 | void setCategoriesRow(int categoriesRow); |
|
24 | void setCategoriesRow(int categoriesRow); |
@@ -8,24 +8,24 QVBarModelMapper::QVBarModelMapper(QObject *parent) : | |||||
8 | QBarModelMapper::setOrientation(Qt::Vertical); |
|
8 | QBarModelMapper::setOrientation(Qt::Vertical); | |
9 | } |
|
9 | } | |
10 |
|
10 | |||
11 | int QVBarModelMapper::firstBarColumn() const |
|
11 | int QVBarModelMapper::firstBarSetColumn() const | |
12 | { |
|
12 | { | |
13 | return QBarModelMapper::firstBarSection(); |
|
13 | return QBarModelMapper::firstBarSetSection(); | |
14 | } |
|
14 | } | |
15 |
|
15 | |||
16 | void QVBarModelMapper::setFirstBarColumn(int firstBarColumn) |
|
16 | void QVBarModelMapper::setFirstBarSetColumn(int firstBarSetColumn) | |
17 | { |
|
17 | { | |
18 | return QBarModelMapper::setFirstBarSection(firstBarColumn); |
|
18 | return QBarModelMapper::setFirstBarSetSection(firstBarSetColumn); | |
19 | } |
|
19 | } | |
20 |
|
20 | |||
21 | int QVBarModelMapper::lastBarColumn() const |
|
21 | int QVBarModelMapper::lastBarSetColumn() const | |
22 | { |
|
22 | { | |
23 | return QBarModelMapper::lastBarSection(); |
|
23 | return QBarModelMapper::lastBarSetSection(); | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | void QVBarModelMapper::setLastBarColumn(int lastBarColumn) |
|
26 | void QVBarModelMapper::setLastBarSetColumn(int lastBarSetColumn) | |
27 | { |
|
27 | { | |
28 | return QBarModelMapper::setLastBarSection(lastBarColumn); |
|
28 | return QBarModelMapper::setLastBarSetSection(lastBarSetColumn); | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 | int QVBarModelMapper::categoriesColumn() const |
|
31 | int QVBarModelMapper::categoriesColumn() const |
@@ -8,17 +8,17 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
8 | class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper |
|
8 | class QTCOMMERCIALCHART_EXPORT QVBarModelMapper : public QBarModelMapper | |
9 | { |
|
9 | { | |
10 | Q_OBJECT |
|
10 | Q_OBJECT | |
11 | Q_PROPERTY(int firstBarColumn READ firstBarColumn WRITE setFirstBarColumn) |
|
11 | Q_PROPERTY(int firstBarSetColumn READ firstBarSetColumn WRITE setFirstBarSetColumn) | |
12 | Q_PROPERTY(int lastBarColumn READ lastBarColumn WRITE setLastBarColumn) |
|
12 | Q_PROPERTY(int lastBarSetColumn READ lastBarSetColumn WRITE setLastBarSetColumn) | |
13 |
|
13 | |||
14 | public: |
|
14 | public: | |
15 | explicit QVBarModelMapper(QObject *parent = 0); |
|
15 | explicit QVBarModelMapper(QObject *parent = 0); | |
16 |
|
16 | |||
17 | int firstBarColumn() const; |
|
17 | int firstBarSetColumn() const; | |
18 | void setFirstBarColumn(int firstBarColumn); |
|
18 | void setFirstBarSetColumn(int firstBarSetColumn); | |
19 |
|
19 | |||
20 | int lastBarColumn() const; |
|
20 | int lastBarSetColumn() const; | |
21 | void setLastBarColumn(int lastBarColumn); |
|
21 | void setLastBarSetColumn(int lastBarSetColumn); | |
22 |
|
22 | |||
23 | int categoriesColumn() const; |
|
23 | int categoriesColumn() const; | |
24 | void setCategoriesColumn(int categoriesColumn); |
|
24 | void setCategoriesColumn(int categoriesColumn); |
General Comments 0
You need to be logged in to leave comments.
Login now