@@ -10,6 +10,19 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
10 | Nothing here yet |
|
10 | Nothing here yet | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
|
13 | /*! | |||
|
14 | \property QHXYModelMapper::xRow | |||
|
15 | \brief Defines which row of the model is kept in sync with the x values of the QXYSeries | |||
|
16 | Default value is: -1 (invalid mapping) | |||
|
17 | */ | |||
|
18 | ||||
|
19 | /*! | |||
|
20 | \property QHXYModelMapper::yRow | |||
|
21 | \brief Defines which row of the model is kept in sync with the y values of the QXYSeries | |||
|
22 | ||||
|
23 | Default value is: -1 (invalid mapping) | |||
|
24 | */ | |||
|
25 | ||||
13 | QHXYModelMapper::QHXYModelMapper(QObject *parent) : |
|
26 | QHXYModelMapper::QHXYModelMapper(QObject *parent) : | |
14 | QXYModelMapper(parent) |
|
27 | QXYModelMapper(parent) | |
15 | { |
|
28 | { |
@@ -10,6 +10,20 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
10 | Nothing here yet |
|
10 | Nothing here yet | |
11 | */ |
|
11 | */ | |
12 |
|
12 | |||
|
13 | /*! | |||
|
14 | \property QVXYModelMapper::xColumn | |||
|
15 | \brief Defines which column of the model is kept in sync with the x values of QXYSeries | |||
|
16 | ||||
|
17 | Default value is: -1 (invalid mapping) | |||
|
18 | */ | |||
|
19 | ||||
|
20 | /*! | |||
|
21 | \property QVXYModelMapper::yColumn | |||
|
22 | \brief Defines which column of the model is kept in sync with the y values of QXYSeries | |||
|
23 | ||||
|
24 | Default value is: -1 (invalid mapping) | |||
|
25 | */ | |||
|
26 | ||||
13 | QVXYModelMapper::QVXYModelMapper(QObject *parent) : |
|
27 | QVXYModelMapper::QVXYModelMapper(QObject *parent) : | |
14 | QXYModelMapper(parent) |
|
28 | QXYModelMapper(parent) | |
15 | { |
|
29 | { |
@@ -5,19 +5,49 | |||||
5 |
|
5 | |||
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
6 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
7 |
|
7 | |||
|
8 | /*! | |||
|
9 | \property QXYModelMapper::series | |||
|
10 | \brief Defines the QPieSeries object that is used by the mapper. | |||
|
11 | ||||
|
12 | All the data in the series in the series is discarded when it is set to the mapper. | |||
|
13 | When new series is specified the old series is disconnected (it preserves its data) | |||
|
14 | */ | |||
|
15 | ||||
|
16 | /*! | |||
|
17 | \property QXYModelMapper::model | |||
|
18 | \brief Defines the model that is used by the mapper. | |||
|
19 | */ | |||
|
20 | ||||
|
21 | /*! | |||
|
22 | \property QXYModelMapper::first | |||
|
23 | \brief Defines which item of the model's row/column should be mapped as the first x/y pair | |||
|
24 | ||||
|
25 | Minimal and default value is: 0 | |||
|
26 | */ | |||
|
27 | ||||
|
28 | /*! | |||
|
29 | \property QXYModelMapper::count | |||
|
30 | \brief Defines the number of rows/columns of the model that are mapped as the data for QXYSeries | |||
|
31 | ||||
|
32 | Minimal and default value is: -1 (count limited by the number of rows/columns in the model) | |||
|
33 | */ | |||
|
34 | ||||
|
35 | /*! | |||
|
36 | \class QXYModelMapper | |||
|
37 | \brief part of QtCommercial chart API. | |||
|
38 | \mainclass | |||
|
39 | ||||
|
40 | The instance of this class cannot be created directly. QHXYModelMapper of QVXYModelMapper should be used instead. This class is used to create a connection between QXYSeries and QAbstractItemModel derived model object. | |||
|
41 | It is possible to use both QAbstractItemModel and QPieSeries model API. QPieModelMapper makes sure that QXYSeries and the model are kept in sync. | |||
|
42 | NOTE: used model has to support adding/removing rows/columns and modifying the data of the cells. | |||
|
43 | */ | |||
|
44 | ||||
8 | QXYModelMapper::QXYModelMapper(QObject *parent): |
|
45 | QXYModelMapper::QXYModelMapper(QObject *parent): | |
9 | QObject(parent), |
|
46 | QObject(parent), | |
10 | d_ptr(new QXYModelMapperPrivate(this)) |
|
47 | d_ptr(new QXYModelMapperPrivate(this)) | |
11 | { |
|
48 | { | |
12 | } |
|
49 | } | |
13 |
|
50 | |||
14 | QXYModelMapper::~QXYModelMapper() |
|
|||
15 | { |
|
|||
16 | Q_D(QXYModelMapper); |
|
|||
17 | disconnect(d->m_model, 0, d, 0); |
|
|||
18 | // disconnect(d->m_series, 0, d, 0); |
|
|||
19 | } |
|
|||
20 |
|
||||
21 | QAbstractItemModel* QXYModelMapper::model() const |
|
51 | QAbstractItemModel* QXYModelMapper::model() const | |
22 | { |
|
52 | { | |
23 | Q_D(const QXYModelMapper); |
|
53 | Q_D(const QXYModelMapper); | |
@@ -94,12 +124,22 void QXYModelMapper::setCount(int count) | |||||
94 | d->initializeXYFromModel(); |
|
124 | d->initializeXYFromModel(); | |
95 | } |
|
125 | } | |
96 |
|
126 | |||
|
127 | /*! | |||
|
128 | Returns the orientation that is used when QXYModelMapper accesses the model. | |||
|
129 | This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal) | |||
|
130 | or from columns (Qt::Vertical) | |||
|
131 | */ | |||
97 | Qt::Orientation QXYModelMapper::orientation() const |
|
132 | Qt::Orientation QXYModelMapper::orientation() const | |
98 | { |
|
133 | { | |
99 | Q_D(const QXYModelMapper); |
|
134 | Q_D(const QXYModelMapper); | |
100 | return d->m_orientation; |
|
135 | return d->m_orientation; | |
101 | } |
|
136 | } | |
102 |
|
137 | |||
|
138 | /*! | |||
|
139 | Returns the \a orientation that is used when QXYModelMapper accesses the model. | |||
|
140 | This mean whether the consecutive x/y values of the QXYSeries are read from rows (Qt::Horizontal) | |||
|
141 | or from columns (Qt::Vertical) | |||
|
142 | */ | |||
103 | void QXYModelMapper::setOrientation(Qt::Orientation orientation) |
|
143 | void QXYModelMapper::setOrientation(Qt::Orientation orientation) | |
104 | { |
|
144 | { | |
105 | Q_D(QXYModelMapper); |
|
145 | Q_D(QXYModelMapper); | |
@@ -107,12 +147,19 void QXYModelMapper::setOrientation(Qt::Orientation orientation) | |||||
107 | d->initializeXYFromModel(); |
|
147 | d->initializeXYFromModel(); | |
108 | } |
|
148 | } | |
109 |
|
149 | |||
|
150 | /*! | |||
|
151 | Returns which section of the model is kept in sync with the x values of the QXYSeries | |||
|
152 | */ | |||
110 | int QXYModelMapper::xSection() const |
|
153 | int QXYModelMapper::xSection() const | |
111 | { |
|
154 | { | |
112 | Q_D(const QXYModelMapper); |
|
155 | Q_D(const QXYModelMapper); | |
113 | return d->m_xSection; |
|
156 | return d->m_xSection; | |
114 | } |
|
157 | } | |
115 |
|
158 | |||
|
159 | /*! | |||
|
160 | Sets the model section that is kept in sync with the x values of the QXYSeries. | |||
|
161 | Parameter \a xSection specifies the section of the model. | |||
|
162 | */ | |||
116 | void QXYModelMapper::setXSection(int xSection) |
|
163 | void QXYModelMapper::setXSection(int xSection) | |
117 | { |
|
164 | { | |
118 | Q_D(QXYModelMapper); |
|
165 | Q_D(QXYModelMapper); | |
@@ -120,12 +167,19 void QXYModelMapper::setXSection(int xSection) | |||||
120 | d->initializeXYFromModel(); |
|
167 | d->initializeXYFromModel(); | |
121 | } |
|
168 | } | |
122 |
|
169 | |||
|
170 | /*! | |||
|
171 | Returns which section of the model is kept in sync with the y values of the QXYSeries | |||
|
172 | */ | |||
123 | int QXYModelMapper::ySection() const |
|
173 | int QXYModelMapper::ySection() const | |
124 | { |
|
174 | { | |
125 | Q_D(const QXYModelMapper); |
|
175 | Q_D(const QXYModelMapper); | |
126 | return d->m_ySection; |
|
176 | return d->m_ySection; | |
127 | } |
|
177 | } | |
128 |
|
178 | |||
|
179 | /*! | |||
|
180 | Sets the model section that is kept in sync with the y values of the QXYSeries. | |||
|
181 | Parameter \a ySection specifies the section of the model. | |||
|
182 | */ | |||
129 | void QXYModelMapper::setYSection(int ySection) |
|
183 | void QXYModelMapper::setYSection(int ySection) | |
130 | { |
|
184 | { | |
131 | Q_D(QXYModelMapper); |
|
185 | Q_D(QXYModelMapper); | |
@@ -133,6 +187,10 void QXYModelMapper::setYSection(int ySection) | |||||
133 | d->initializeXYFromModel(); |
|
187 | d->initializeXYFromModel(); | |
134 | } |
|
188 | } | |
135 |
|
189 | |||
|
190 | /*! | |||
|
191 | Resets the QXYModelMapper to the default state. | |||
|
192 | first: 0; count: -1; xSection: -1; ySection: -1; | |||
|
193 | */ | |||
136 | void QXYModelMapper::reset() |
|
194 | void QXYModelMapper::reset() | |
137 | { |
|
195 | { | |
138 | Q_D(QXYModelMapper); |
|
196 | Q_D(QXYModelMapper); |
@@ -37,7 +37,6 public: | |||||
37 |
|
37 | |||
38 | protected: |
|
38 | protected: | |
39 | explicit QXYModelMapper(QObject *parent = 0); |
|
39 | explicit QXYModelMapper(QObject *parent = 0); | |
40 | ~QXYModelMapper(); |
|
|||
41 |
|
40 | |||
42 | Qt::Orientation orientation() const; |
|
41 | Qt::Orientation orientation() const; | |
43 | void setOrientation(Qt::Orientation orientation); |
|
42 | void setOrientation(Qt::Orientation orientation); |
General Comments 0
You need to be logged in to leave comments.
Login now