@@ -125,13 +125,17 | |||
|
125 | 125 | \fn void QScatterSeries::colorChanged(QColor color) |
|
126 | 126 | Signal is emitted when the fill (brush) color has changed to \a color. |
|
127 | 127 | */ |
|
128 | /*! | |
|
129 | \qmlsignal ScatterSeries::onColorChanged(color color) | |
|
130 | Signal is emitted when the fill (brush) color has changed to \a color. | |
|
131 | */ | |
|
128 | 132 | |
|
129 | 133 | /*! |
|
130 | 134 | \fn void QScatterSeries::borderColorChanged(QColor color) |
|
131 | 135 | Signal is emitted when the line (pen) color has changed to \a color. |
|
132 | 136 | */ |
|
133 | 137 | /*! |
|
134 |
\qmlsignal ScatterSeries:: |
|
|
138 | \qmlsignal ScatterSeries::onBorderColorChanged(color color) | |
|
135 | 139 | Signal is emitted when the line (pen) color has changed to \a color. |
|
136 | 140 | */ |
|
137 | 141 | |
@@ -141,6 +145,23 | |||
|
141 | 145 | \sa QAbstractSeries, SeriesType |
|
142 | 146 | */ |
|
143 | 147 | |
|
148 | /*! | |
|
149 | \fn void QScatterSeries::markerShapeChanged(MarkerShape shape) | |
|
150 | Signal is emitted when the marker shape has changed to \a shape. | |
|
151 | */ | |
|
152 | /*! | |
|
153 | \qmlsignal ScatterSeries::onMarkerShapeChanged(MarkerShape shape) | |
|
154 | Signal is emitted when the marker shape has changed to \a shape. | |
|
155 | */ | |
|
156 | /*! | |
|
157 | \fn void QScatterSeries::markerSizeChanged(qreal size) | |
|
158 | Signal is emitted when the marker size has changed to \a size. | |
|
159 | */ | |
|
160 | /*! | |
|
161 | \qmlsignal ScatterSeries::onMarkerSizeChanged(real size) | |
|
162 | Signal is emitted when the marker size has changed to \a size. | |
|
163 | */ | |
|
164 | ||
|
144 | 165 | QT_CHARTS_BEGIN_NAMESPACE |
|
145 | 166 | |
|
146 | 167 | /*! |
@@ -251,6 +272,7 void QScatterSeries::setMarkerShape(MarkerShape shape) | |||
|
251 | 272 | if (d->m_shape != shape) { |
|
252 | 273 | d->m_shape = shape; |
|
253 | 274 | emit d->updated(); |
|
275 | emit markerShapeChanged(shape); | |
|
254 | 276 | } |
|
255 | 277 | } |
|
256 | 278 | |
@@ -267,6 +289,7 void QScatterSeries::setMarkerSize(qreal size) | |||
|
267 | 289 | if (!qFuzzyCompare(d->m_size, size)) { |
|
268 | 290 | d->m_size = size; |
|
269 | 291 | emit d->updated(); |
|
292 | emit markerSizeChanged(size); | |
|
270 | 293 | } |
|
271 | 294 | } |
|
272 | 295 |
@@ -31,8 +31,8 class QT_CHARTS_EXPORT QScatterSeries : public QXYSeries | |||
|
31 | 31 | Q_OBJECT |
|
32 | 32 | Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) |
|
33 | 33 | Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) |
|
34 | Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape) | |
|
35 | Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize) | |
|
34 | Q_PROPERTY(MarkerShape markerShape READ markerShape WRITE setMarkerShape NOTIFY markerShapeChanged) | |
|
35 | Q_PROPERTY(qreal markerSize READ markerSize WRITE setMarkerSize NOTIFY markerSizeChanged) | |
|
36 | 36 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush) |
|
37 | 37 | Q_ENUMS(MarkerShape) |
|
38 | 38 | |
@@ -61,6 +61,8 public: | |||
|
61 | 61 | Q_SIGNALS: |
|
62 | 62 | void colorChanged(QColor color); |
|
63 | 63 | void borderColorChanged(QColor color); |
|
64 | void markerShapeChanged(MarkerShape shape); | |
|
65 | void markerSizeChanged(qreal size); | |
|
64 | 66 | |
|
65 | 67 | private: |
|
66 | 68 | Q_DECLARE_PRIVATE(QScatterSeries) |
@@ -44,13 +44,17 void GLXYSeriesDataManager::setPoints(QXYSeries *series, const AbstractDomain *d | |||
|
44 | 44 | QScatterSeries *scatter = static_cast<QScatterSeries *>(series); |
|
45 | 45 | data->width = float(scatter->markerSize()); |
|
46 | 46 | sc = scatter->color(); // Scatter overwrites color property |
|
47 | connect(scatter, &QScatterSeries::colorChanged, this, | |
|
48 | &GLXYSeriesDataManager::handleScatterColorChange); | |
|
49 | connect(scatter, &QScatterSeries::markerSizeChanged, this, | |
|
50 | &GLXYSeriesDataManager::handleScatterMarkerSizeChange); | |
|
47 | 51 | } else { |
|
48 | 52 | data->width = float(series->pen().widthF()); |
|
49 | 53 | sc = series->color(); |
|
50 | } | |
|
51 | data->color = QVector3D(float(sc.redF()), float(sc.greenF()), float(sc.blueF())); | |
|
52 | 54 | connect(series, &QXYSeries::penChanged, this, |
|
53 | 55 | &GLXYSeriesDataManager::handleSeriesPenChange); |
|
56 | } | |
|
57 | data->color = QVector3D(float(sc.redF()), float(sc.greenF()), float(sc.blueF())); | |
|
54 | 58 | connect(series, &QXYSeries::useOpenGLChanged, this, |
|
55 | 59 | &GLXYSeriesDataManager::handleSeriesOpenGLChange); |
|
56 | 60 | m_seriesDataMap.insert(series, data); |
@@ -133,6 +137,7 void GLXYSeriesDataManager::handleSeriesPenChange() | |||
|
133 | 137 | QColor sc = series->color(); |
|
134 | 138 | data->color = QVector3D(float(sc.redF()), float(sc.greenF()), float(sc.blueF())); |
|
135 | 139 | data->width = float(series->pen().widthF()); |
|
140 | data->dirty = true; | |
|
136 | 141 | } |
|
137 | 142 | } |
|
138 | 143 | } |
@@ -144,4 +149,30 void GLXYSeriesDataManager::handleSeriesOpenGLChange() | |||
|
144 | 149 | removeSeries(series); |
|
145 | 150 | } |
|
146 | 151 | |
|
152 | void GLXYSeriesDataManager::handleScatterColorChange() | |
|
153 | { | |
|
154 | QScatterSeries *series = qobject_cast<QScatterSeries *>(sender()); | |
|
155 | if (series) { | |
|
156 | GLXYSeriesData *data = m_seriesDataMap.value(series); | |
|
157 | if (data) { | |
|
158 | QColor sc = series->color(); | |
|
159 | data->color = QVector3D(float(sc.redF()), float(sc.greenF()), float(sc.blueF())); | |
|
160 | data->dirty = true; | |
|
161 | } | |
|
162 | } | |
|
163 | } | |
|
164 | ||
|
165 | void GLXYSeriesDataManager::handleScatterMarkerSizeChange() | |
|
166 | { | |
|
167 | QScatterSeries *series = qobject_cast<QScatterSeries *>(sender()); | |
|
168 | if (series) { | |
|
169 | GLXYSeriesData *data = m_seriesDataMap.value(series); | |
|
170 | if (data) { | |
|
171 | data->width =float(series->markerSize()); | |
|
172 | data->dirty = true; | |
|
173 | } | |
|
174 | } | |
|
175 | } | |
|
176 | ||
|
147 | 177 | QT_CHARTS_END_NAMESPACE |
|
178 |
General Comments 0
You need to be logged in to leave comments.
Login now