##// END OF EJS Templates
Changes QChartAxisCategories -> QAxisCategories
Michal Klocek -
r1032:f1315a97f81e
parent child
Show More
1 NO CONTENT: modified file
@@ -89,12 +89,12 int main(int argc, char *argv[])
89 89 //![3]
90 90
91 91 //![4]
92 QChartAxisCategories* categoriesX = chart->axisX()->categories();
92 QAxisCategories* categoriesX = chart->axisX()->categories();
93 93 categoriesX->insert(1,"low");
94 94 categoriesX->insert(5,"optimal");
95 95 categoriesX->insert(10,"high");
96 96
97 QChartAxisCategories* categoriesY = chart->axisY()->categories();
97 QAxisCategories* categoriesY = chart->axisY()->categories();
98 98 categoriesY->insert(1,"slow");
99 99 categoriesY->insert(5,"med");
100 100 categoriesY->insert(10,"fast");
@@ -4,13 +4,13 DEPENDPATH += $$PWD
4 4 SOURCES += \
5 5 $$PWD/chartaxis.cpp \
6 6 $$PWD/qaxis.cpp \
7 $$PWD/qchartaxiscategories.cpp
7 $$PWD/qaxiscategories.cpp
8 8
9 9 PRIVATE_HEADERS += \
10 10 $$PWD/chartaxis_p.h \
11 11 $$PWD/qaxis_p.h \
12 $$PWD/qchartaxiscategories_p.h
12 $$PWD/qaxiscategories_p.h
13 13
14 14 PUBLIC_HEADERS += \
15 15 $$PWD/qaxis.h \
16 $$PWD/qchartaxiscategories.h No newline at end of file
16 $$PWD/qaxiscategories.h No newline at end of file
@@ -21,7 +21,7
21 21 #include "chartaxis_p.h"
22 22 #include "qaxis.h"
23 23 #include "qaxis_p.h"
24 #include "qchartaxiscategories_p.h"
24 #include "qaxiscategories_p.h"
25 25 #include "chartpresenter_p.h"
26 26 #include "chartanimator_p.h"
27 27 #include <QPainter>
@@ -103,7 +103,7 bool ChartAxis::createLabels(QStringList &labels,qreal min, qreal max,int ticks)
103 103 Q_ASSERT(max>=min);
104 104 Q_ASSERT(ticks>1);
105 105
106 QChartAxisCategories* categories = m_chartAxis->categories();
106 QAxisCategories* categories = m_chartAxis->categories();
107 107
108 108 bool category = categories->count()>0;
109 109
@@ -493,7 +493,7 bool QAxis::niceNumbersEnabled() const
493 493 return d_ptr->m_niceNumbers;
494 494 }
495 495
496 QChartAxisCategories* QAxis::categories()
496 QAxisCategories* QAxis::categories()
497 497 {
498 498 return &d_ptr->m_category;
499 499 }
@@ -22,7 +22,7
22 22 #define QAXIS_H
23 23
24 24 #include <qchartglobal.h>
25 #include <qchartaxiscategories.h>
25 #include <qaxiscategories.h>
26 26 #include <QPen>
27 27 #include <QFont>
28 28
@@ -86,7 +86,7 public:
86 86 void setNiceNumbersEnabled(bool enable = true);
87 87 bool niceNumbersEnabled() const;
88 88
89 QChartAxisCategories* categories();
89 QAxisCategories* categories();
90 90
91 91 void show();
92 92 void hide();
@@ -73,7 +73,7 private:
73 73 qreal m_max;
74 74
75 75 int m_ticksCount;
76 QChartAxisCategories m_category;
76 QAxisCategories m_category;
77 77
78 78 bool m_niceNumbers;
79 79
@@ -18,23 +18,23
18 18 **
19 19 ****************************************************************************/
20 20
21 #include "qchartaxiscategories.h"
22 #include "qchartaxiscategories_p.h"
21 #include "qaxiscategories.h"
22 #include "qaxiscategories_p.h"
23 23
24 24 QTCOMMERCIALCHART_BEGIN_NAMESPACE
25 25
26 QChartAxisCategories::QChartAxisCategories():
27 d_ptr(new QChartAxisCategoriesPrivate(this))
26 QAxisCategories::QAxisCategories():
27 d_ptr(new QAxisCategoriesPrivate(this))
28 28 {
29 29
30 30 }
31 31
32 QChartAxisCategories::~QChartAxisCategories()
32 QAxisCategories::~QAxisCategories()
33 33 {
34 34
35 35 }
36 36
37 void QChartAxisCategories::insert(const QBarCategories &categories)
37 void QAxisCategories::insert(const QBarCategories &categories)
38 38 {
39 39 int i=1;
40 40 foreach (const QString& string , categories) {
@@ -44,53 +44,53 void QChartAxisCategories::insert(const QBarCategories &categories)
44 44 emit d_ptr->updated();
45 45 }
46 46
47 void QChartAxisCategories::insert(qreal value,QString label)
47 void QAxisCategories::insert(qreal value,QString label)
48 48 {
49 49 d_ptr->m_map.insert(value,label);
50 50 emit d_ptr->updated();
51 51 }
52 52
53 void QChartAxisCategories::remove(qreal value)
53 void QAxisCategories::remove(qreal value)
54 54 {
55 55 d_ptr->m_map.remove(value);
56 56 emit d_ptr->updated();
57 57 }
58 58
59 void QChartAxisCategories::clear()
59 void QAxisCategories::clear()
60 60 {
61 61 d_ptr->m_map.clear();
62 62 emit d_ptr->updated();
63 63 }
64 64
65 int QChartAxisCategories::count()
65 int QAxisCategories::count()
66 66 {
67 67 return d_ptr->m_map.count();
68 68 }
69 69
70 QList<qreal> QChartAxisCategories::values() const
70 QList<qreal> QAxisCategories::values() const
71 71 {
72 72 return d_ptr->m_map.keys();
73 73 }
74 74
75 QString QChartAxisCategories::label(qreal value) const
75 QString QAxisCategories::label(qreal value) const
76 76 {
77 77 return d_ptr->m_map.value(value);
78 78 }
79 79
80 80 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
81 81
82 QChartAxisCategoriesPrivate::QChartAxisCategoriesPrivate(QChartAxisCategories *q):
82 QAxisCategoriesPrivate::QAxisCategoriesPrivate(QAxisCategories *q):
83 83 q_ptr(q)
84 84 {
85 85
86 86 }
87 87
88 QChartAxisCategoriesPrivate::~QChartAxisCategoriesPrivate()
88 QAxisCategoriesPrivate::~QAxisCategoriesPrivate()
89 89 {
90 90
91 91 }
92 92
93 #include "moc_qchartaxiscategories.cpp"
94 #include "moc_qchartaxiscategories_p.cpp"
93 #include "moc_qaxiscategories.cpp"
94 #include "moc_qaxiscategories_p.cpp"
95 95
96 96 QTCOMMERCIALCHART_END_NAMESPACE
@@ -18,23 +18,23
18 18 **
19 19 ****************************************************************************/
20 20
21 #ifndef QCHARTAXISCATEGORIES_H
22 #define QCHARTAXISCATEGORIES_H
21 #ifndef QAXISCATEGORIES_H
22 #define QAXISCATEGORIES_H
23 23
24 24 #include <qchartglobal.h>
25 25 #include <qbarseries.h>
26 26
27 27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28 28
29 class QChartAxisCategoriesPrivate;
29 class QAxisCategoriesPrivate;
30 30
31 class QTCOMMERCIALCHART_EXPORT QChartAxisCategories : public QObject
31 class QTCOMMERCIALCHART_EXPORT QAxisCategories : public QObject
32 32 {
33 33 Q_OBJECT
34 34 private:
35 QChartAxisCategories();
35 QAxisCategories();
36 36 public:
37 ~QChartAxisCategories();
37 ~QAxisCategories();
38 38
39 39 void insert(const QBarCategories &category);
40 40 void insert(qreal value,QString label);
@@ -45,7 +45,7 public:
45 45 int count();
46 46
47 47 private:
48 QScopedPointer<QChartAxisCategoriesPrivate> d_ptr;
48 QScopedPointer<QAxisCategoriesPrivate> d_ptr;
49 49 friend class QAxisPrivate;
50 50 friend class ChartAxis;
51 51 };
@@ -27,28 +27,28
27 27 //
28 28 // We mean it.
29 29
30 #ifndef QCHARTAXISCATEGORIES_P_H
31 #define QCHARTAXISCATEGORIES_P_H
30 #ifndef QAXISCATEGORIES_P_H
31 #define QAXISCATEGORIES_P_H
32 32
33 #include "qchartaxiscategories.h"
33 #include "qaxiscategories.h"
34 34 #include <QMap>
35 35
36 36 QTCOMMERCIALCHART_BEGIN_NAMESPACE
37 37
38 class QChartAxisCategoriesPrivate : public QObject
38 class QAxisCategoriesPrivate : public QObject
39 39 {
40 40 Q_OBJECT
41 41 public:
42 QChartAxisCategoriesPrivate(QChartAxisCategories *q);
43 ~QChartAxisCategoriesPrivate();
42 QAxisCategoriesPrivate(QAxisCategories *q);
43 ~QAxisCategoriesPrivate();
44 44
45 45 Q_SIGNALS:
46 46 void updated();
47 47
48 48 private:
49 QChartAxisCategories *q_ptr;
49 QAxisCategories *q_ptr;
50 50 QMap<qreal,QString> m_map;
51 friend class QChartAxisCategories;
51 friend class QAxisCategories;
52 52
53 53 };
54 54
@@ -26,8 +26,6
26 26 #include "qbarseries.h"
27 27 #include "qbarseries_p.h"
28 28 #include "qchart.h"
29 //#include "qchartaxis.h"
30 #include "qchartaxiscategories.h"
31 29 #include "chartpresenter_p.h"
32 30 #include "chartanimator_p.h"
33 31 #include "chartdataset_p.h"
@@ -30,7 +30,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 30
31 31 class Bar;
32 32 class BarLabel;
33 class QChartAxisCategories;
33 class QAxisCategories;
34 34 class QChart;
35 35
36 36 //typedef QVector<QRectF> BarLayout;
@@ -168,7 +168,7 void ChartDataSet::removeAllSeries()
168 168
169 169 void ChartDataSet::setupCategories(QBarSeries* series)
170 170 {
171 QChartAxisCategories* categories = axisX()->categories();
171 QAxisCategories* categories = axisX()->categories();
172 172 categories->clear();
173 173 categories->insert(series->categories());
174 174 }
General Comments 0
You need to be logged in to leave comments. Login now