@@ -298,29 +298,8 QBarSeriesPrivate::QBarSeriesPrivate(QBarSeries *q) : | |||
|
298 | 298 | { |
|
299 | 299 | } |
|
300 | 300 | |
|
301 | void QBarSeriesPrivate::setCategories(QStringList categories) | |
|
302 | { | |
|
303 | m_categories = categories; | |
|
304 | } | |
|
305 | ||
|
306 | void QBarSeriesPrivate::insertCategory(int index, const QString category) | |
|
307 | { | |
|
308 | m_categories.insert(index, category); | |
|
309 | emit categoriesUpdated(); | |
|
310 | } | |
|
311 | ||
|
312 | void QBarSeriesPrivate::removeCategory(int index) | |
|
313 | { | |
|
314 | m_categories.removeAt(index); | |
|
315 | emit categoriesUpdated(); | |
|
316 | } | |
|
317 | ||
|
318 | 301 | int QBarSeriesPrivate::categoryCount() const |
|
319 | 302 | { |
|
320 | if (m_categories.count() > 0) { | |
|
321 | return m_categories.count(); | |
|
322 | } | |
|
323 | ||
|
324 | 303 | // No categories defined. return count of longest set. |
|
325 | 304 | int count = 0; |
|
326 | 305 | for (int i=0; i<m_barSets.count(); i++) { |
@@ -332,22 +311,6 int QBarSeriesPrivate::categoryCount() const | |||
|
332 | 311 | return count; |
|
333 | 312 | } |
|
334 | 313 | |
|
335 | QStringList QBarSeriesPrivate::categories() const | |
|
336 | { | |
|
337 | if (m_categories.count() > 0) { | |
|
338 | return m_categories; | |
|
339 | } | |
|
340 | ||
|
341 | // No categories defined. retun list of indices. | |
|
342 | QStringList categories; | |
|
343 | ||
|
344 | int count = categoryCount(); | |
|
345 | for (int i = 0; i < count; i++) { | |
|
346 | categories.append(QString::number(i)); | |
|
347 | } | |
|
348 | return categories; | |
|
349 | } | |
|
350 | ||
|
351 | 314 | void QBarSeriesPrivate::setBarWidth(qreal width) |
|
352 | 315 | { |
|
353 | 316 | if (width < 0.0) { |
@@ -379,15 +342,6 void QBarSeriesPrivate::setLabelsVisible(bool visible) | |||
|
379 | 342 | emit labelsVisibleChanged(visible); |
|
380 | 343 | } |
|
381 | 344 | |
|
382 | QString QBarSeriesPrivate::categoryName(int category) | |
|
383 | { | |
|
384 | if ((category >= 0) && (category < m_categories.count())) { | |
|
385 | return m_categories.at(category); | |
|
386 | } | |
|
387 | ||
|
388 | return QString::number(category); | |
|
389 | } | |
|
390 | ||
|
391 | 345 | qreal QBarSeriesPrivate::min() |
|
392 | 346 | { |
|
393 | 347 | if (m_barSets.count() <= 0) { |
@@ -44,12 +44,7 class QBarSeriesPrivate : public QAbstractSeriesPrivate | |||
|
44 | 44 | Q_OBJECT |
|
45 | 45 | public: |
|
46 | 46 | QBarSeriesPrivate(QBarSeries *parent); |
|
47 | // TODO: refactor/remove private category stuff | |
|
48 | void setCategories(QStringList categories); | |
|
49 | void insertCategory(int index, const QString category); | |
|
50 | void removeCategory(int index); | |
|
51 | 47 | int categoryCount() const; |
|
52 | QStringList categories() const; | |
|
53 | 48 | |
|
54 | 49 | void setBarWidth(qreal width); |
|
55 | 50 | qreal barWidth() const; |
@@ -68,7 +63,6 public: | |||
|
68 | 63 | bool insert(int index, QBarSet *set); |
|
69 | 64 | |
|
70 | 65 | QBarSet* barsetAt(int index); |
|
71 | QString categoryName(int category); | |
|
72 | 66 | qreal min(); |
|
73 | 67 | qreal max(); |
|
74 | 68 | qreal valueAt(int set, int category); |
@@ -83,12 +77,10 Q_SIGNALS: | |||
|
83 | 77 | void clicked(QBarSet *barset, int index); |
|
84 | 78 | void updatedBars(); |
|
85 | 79 | void restructuredBars(); |
|
86 | void categoriesUpdated(); | |
|
87 | 80 | void labelsVisibleChanged(bool visible); |
|
88 | 81 | |
|
89 | 82 | protected: |
|
90 | 83 | QList<QBarSet *> m_barSets; |
|
91 | QStringList m_categories; | |
|
92 | 84 | qreal m_barWidth; |
|
93 | 85 | bool m_labelsVisible; |
|
94 | 86 | bool m_visible; |
General Comments 0
You need to be logged in to leave comments.
Login now