@@ -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 | int QBarSeriesPrivate::categoryCount() const |
|
301 | int QBarSeriesPrivate::categoryCount() const | |
319 | { |
|
302 | { | |
320 | if (m_categories.count() > 0) { |
|
|||
321 | return m_categories.count(); |
|
|||
322 | } |
|
|||
323 |
|
||||
324 | // No categories defined. return count of longest set. |
|
303 | // No categories defined. return count of longest set. | |
325 | int count = 0; |
|
304 | int count = 0; | |
326 | for (int i=0; i<m_barSets.count(); i++) { |
|
305 | for (int i=0; i<m_barSets.count(); i++) { | |
@@ -332,22 +311,6 int QBarSeriesPrivate::categoryCount() const | |||||
332 | return count; |
|
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 | void QBarSeriesPrivate::setBarWidth(qreal width) |
|
314 | void QBarSeriesPrivate::setBarWidth(qreal width) | |
352 | { |
|
315 | { | |
353 | if (width < 0.0) { |
|
316 | if (width < 0.0) { | |
@@ -379,15 +342,6 void QBarSeriesPrivate::setLabelsVisible(bool visible) | |||||
379 | emit labelsVisibleChanged(visible); |
|
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 | qreal QBarSeriesPrivate::min() |
|
345 | qreal QBarSeriesPrivate::min() | |
392 | { |
|
346 | { | |
393 | if (m_barSets.count() <= 0) { |
|
347 | if (m_barSets.count() <= 0) { |
@@ -44,12 +44,7 class QBarSeriesPrivate : public QAbstractSeriesPrivate | |||||
44 | Q_OBJECT |
|
44 | Q_OBJECT | |
45 | public: |
|
45 | public: | |
46 | QBarSeriesPrivate(QBarSeries *parent); |
|
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 | int categoryCount() const; |
|
47 | int categoryCount() const; | |
52 | QStringList categories() const; |
|
|||
53 |
|
48 | |||
54 | void setBarWidth(qreal width); |
|
49 | void setBarWidth(qreal width); | |
55 | qreal barWidth() const; |
|
50 | qreal barWidth() const; | |
@@ -68,7 +63,6 public: | |||||
68 | bool insert(int index, QBarSet *set); |
|
63 | bool insert(int index, QBarSet *set); | |
69 |
|
64 | |||
70 | QBarSet* barsetAt(int index); |
|
65 | QBarSet* barsetAt(int index); | |
71 | QString categoryName(int category); |
|
|||
72 | qreal min(); |
|
66 | qreal min(); | |
73 | qreal max(); |
|
67 | qreal max(); | |
74 | qreal valueAt(int set, int category); |
|
68 | qreal valueAt(int set, int category); | |
@@ -83,12 +77,10 Q_SIGNALS: | |||||
83 | void clicked(QBarSet *barset, int index); |
|
77 | void clicked(QBarSet *barset, int index); | |
84 | void updatedBars(); |
|
78 | void updatedBars(); | |
85 | void restructuredBars(); |
|
79 | void restructuredBars(); | |
86 | void categoriesUpdated(); |
|
|||
87 | void labelsVisibleChanged(bool visible); |
|
80 | void labelsVisibleChanged(bool visible); | |
88 |
|
81 | |||
89 | protected: |
|
82 | protected: | |
90 | QList<QBarSet *> m_barSets; |
|
83 | QList<QBarSet *> m_barSets; | |
91 | QStringList m_categories; |
|
|||
92 | qreal m_barWidth; |
|
84 | qreal m_barWidth; | |
93 | bool m_labelsVisible; |
|
85 | bool m_labelsVisible; | |
94 | bool m_visible; |
|
86 | bool m_visible; |
General Comments 0
You need to be logged in to leave comments.
Login now