@@ -39,6 +39,7 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) | |||
|
39 | 39 | m_pointLabelsFormat(areaSeries->pointLabelsFormat()), |
|
40 | 40 | m_pointLabelsFont(areaSeries->pointLabelsFont()), |
|
41 | 41 | m_pointLabelsColor(areaSeries->pointLabelsColor()), |
|
42 | m_pointLabelsClipping(true), | |
|
42 | 43 | m_mousePressed(false) |
|
43 | 44 | { |
|
44 | 45 | setAcceptHoverEvents(true); |
@@ -66,6 +67,8 AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) | |||
|
66 | 67 | this, SLOT(handleUpdated())); |
|
67 | 68 | QObject::connect(areaSeries, SIGNAL(pointLabelsColorChanged(QColor)), |
|
68 | 69 | this, SLOT(handleUpdated())); |
|
70 | QObject::connect(areaSeries, SIGNAL(pointLabelsClippingChanged(bool)), | |
|
71 | this, SLOT(handleUpdated())); | |
|
69 | 72 | |
|
70 | 73 | handleUpdated(); |
|
71 | 74 | } |
@@ -151,6 +154,7 void AreaChartItem::handleUpdated() | |||
|
151 | 154 | m_pointLabelsVisible = m_series->pointLabelsVisible(); |
|
152 | 155 | m_pointLabelsFont = m_series->pointLabelsFont(); |
|
153 | 156 | m_pointLabelsColor = m_series->pointLabelsColor(); |
|
157 | m_pointLabelsClipping = m_series->pointLabelsClipping(); | |
|
154 | 158 | update(); |
|
155 | 159 | } |
|
156 | 160 | |
@@ -202,6 +206,11 void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||
|
202 | 206 | static const QString yPointTag(QLatin1String("@yPoint")); |
|
203 | 207 | const int labelOffset = 2; |
|
204 | 208 | |
|
209 | if (m_pointLabelsClipping) | |
|
210 | painter->setClipping(true); | |
|
211 | else | |
|
212 | painter->setClipping(false); | |
|
213 | ||
|
205 | 214 | painter->setFont(m_pointLabelsFont); |
|
206 | 215 | painter->setPen(QPen(m_pointLabelsColor)); |
|
207 | 216 | QFontMetrics fm(painter->font()); |
@@ -90,6 +90,7 private: | |||
|
90 | 90 | QString m_pointLabelsFormat; |
|
91 | 91 | QFont m_pointLabelsFont; |
|
92 | 92 | QColor m_pointLabelsColor; |
|
93 | bool m_pointLabelsClipping; | |
|
93 | 94 | |
|
94 | 95 | QPointF m_lastMousePos; |
|
95 | 96 | bool m_mousePressed; |
@@ -269,13 +269,13 QT_CHARTS_BEGIN_NAMESPACE | |||
|
269 | 269 | \property QAreaSeries::pointLabelsVisible |
|
270 | 270 | Defines the visibility for data point labels. False by default. |
|
271 | 271 | |
|
272 | \sa QAreaSeries::pointLabelsFormat | |
|
272 | \sa QAreaSeries::pointLabelsFormat, QAreaSeries::pointLabelsClipping | |
|
273 | 273 | */ |
|
274 | 274 | /*! |
|
275 | 275 | \qmlproperty bool AreaSeries::pointLabelsVisible |
|
276 | 276 | Defines the visibility for data point labels. |
|
277 | 277 | |
|
278 | \sa pointLabelsFormat | |
|
278 | \sa pointLabelsFormat, pointLabelsClipping | |
|
279 | 279 | */ |
|
280 | 280 | /*! |
|
281 | 281 | \fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible) |
@@ -331,6 +331,29 QT_CHARTS_BEGIN_NAMESPACE | |||
|
331 | 331 | */ |
|
332 | 332 | |
|
333 | 333 | /*! |
|
334 | \property QAreaSeries::pointLabelsClipping | |
|
335 | Defines the clipping for data point labels. True by default. The labels on the edge of the plot | |
|
336 | area are cut when clipping is enabled. | |
|
337 | ||
|
338 | \sa pointLabelsVisible | |
|
339 | */ | |
|
340 | /*! | |
|
341 | \qmlproperty bool AreaSeries::pointLabelsClipping | |
|
342 | Defines the clipping for data point labels. True by default. The labels on the edge of the plot | |
|
343 | area are cut when clipping is enabled. | |
|
344 | ||
|
345 | \sa pointLabelsVisible | |
|
346 | */ | |
|
347 | /*! | |
|
348 | \fn void QAreaSeries::pointLabelsClippintChanged(bool clipping) | |
|
349 | The clipping of the data point labels is changed to \a clipping. | |
|
350 | */ | |
|
351 | /*! | |
|
352 | \qmlsignal AreaSeries::onPointLabelsClippingChanged(bool clipping) | |
|
353 | The clipping of the data point labels is changed to \a clipping. | |
|
354 | */ | |
|
355 | ||
|
356 | /*! | |
|
334 | 357 | Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a |
|
335 | 358 | upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. |
|
336 | 359 | When series object is added to QChartView or QChart instance ownerships is transferred. |
@@ -556,6 +579,21 QColor QAreaSeries::pointLabelsColor() const | |||
|
556 | 579 | return d->m_pointLabelsColor; |
|
557 | 580 | } |
|
558 | 581 | |
|
582 | void QAreaSeries::setPointLabelsClipping(bool enabled) | |
|
583 | { | |
|
584 | Q_D(QAreaSeries); | |
|
585 | if (d->m_pointLabelsClipping != enabled) { | |
|
586 | d->m_pointLabelsClipping = enabled; | |
|
587 | emit pointLabelsClippingChanged(enabled); | |
|
588 | } | |
|
589 | } | |
|
590 | ||
|
591 | bool QAreaSeries::pointLabelsClipping() const | |
|
592 | { | |
|
593 | Q_D(const QAreaSeries); | |
|
594 | return d->m_pointLabelsClipping; | |
|
595 | } | |
|
596 | ||
|
559 | 597 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
|
560 | 598 | |
|
561 | 599 | QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q) |
@@ -568,7 +606,8 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lo | |||
|
568 | 606 | m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")), |
|
569 | 607 | m_pointLabelsVisible(false), |
|
570 | 608 | m_pointLabelsFont(QChartPrivate::defaultFont()), |
|
571 | m_pointLabelsColor(QChartPrivate::defaultPen().color()) | |
|
609 | m_pointLabelsColor(QChartPrivate::defaultPen().color()), | |
|
610 | m_pointLabelsClipping(true) | |
|
572 | 611 | { |
|
573 | 612 | } |
|
574 | 613 |
@@ -39,6 +39,7 class QT_CHARTS_EXPORT QAreaSeries : public QAbstractSeries | |||
|
39 | 39 | Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged) |
|
40 | 40 | Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged) |
|
41 | 41 | Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged) |
|
42 | Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged) | |
|
42 | 43 | |
|
43 | 44 | public: |
|
44 | 45 | explicit QAreaSeries(QObject *parent = 0); |
@@ -80,6 +81,9 public: | |||
|
80 | 81 | void setPointLabelsColor(const QColor &color); |
|
81 | 82 | QColor pointLabelsColor() const; |
|
82 | 83 | |
|
84 | void setPointLabelsClipping(bool enabled = true); | |
|
85 | bool pointLabelsClipping() const; | |
|
86 | ||
|
83 | 87 | Q_SIGNALS: |
|
84 | 88 | void clicked(const QPointF &point); |
|
85 | 89 | void hovered(const QPointF &point, bool state); |
@@ -93,6 +97,7 Q_SIGNALS: | |||
|
93 | 97 | void pointLabelsVisibilityChanged(bool visible); |
|
94 | 98 | void pointLabelsFontChanged(const QFont &font); |
|
95 | 99 | void pointLabelsColorChanged(const QColor &color); |
|
100 | void pointLabelsClippingChanged(bool clipping); | |
|
96 | 101 | |
|
97 | 102 | private: |
|
98 | 103 | Q_DECLARE_PRIVATE(QAreaSeries) |
@@ -67,6 +67,8 protected: | |||
|
67 | 67 | bool m_pointLabelsVisible; |
|
68 | 68 | QFont m_pointLabelsFont; |
|
69 | 69 | QColor m_pointLabelsColor; |
|
70 | bool m_pointLabelsClipping; | |
|
71 | ||
|
70 | 72 | private: |
|
71 | 73 | Q_DECLARE_PUBLIC(QAreaSeries); |
|
72 | 74 | }; |
@@ -39,6 +39,7 LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item) | |||
|
39 | 39 | m_pointLabelsFormat(series->pointLabelsFormat()), |
|
40 | 40 | m_pointLabelsFont(series->pointLabelsFont()), |
|
41 | 41 | m_pointLabelsColor(series->pointLabelsColor()), |
|
42 | m_pointLabelsClipping(true), | |
|
42 | 43 | m_mousePressed(false) |
|
43 | 44 | { |
|
44 | 45 | setAcceptHoverEvents(true); |
@@ -53,6 +54,7 LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item) | |||
|
53 | 54 | this, SLOT(handleUpdated())); |
|
54 | 55 | QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated())); |
|
55 | 56 | QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); |
|
57 | QObject::connect(series, SIGNAL(pointLabelsClippingChanged(bool)), this, SLOT(handleUpdated())); | |
|
56 | 58 | handleUpdated(); |
|
57 | 59 | } |
|
58 | 60 | |
@@ -330,6 +332,7 void LineChartItem::handleUpdated() | |||
|
330 | 332 | m_pointLabelsVisible = m_series->pointLabelsVisible(); |
|
331 | 333 | m_pointLabelsFont = m_series->pointLabelsFont(); |
|
332 | 334 | m_pointLabelsColor = m_series->pointLabelsColor(); |
|
335 | m_pointLabelsClipping = m_series->pointLabelsClipping(); | |
|
333 | 336 | if (doGeometryUpdate) |
|
334 | 337 | updateGeometry(); |
|
335 | 338 | update(); |
@@ -382,8 +385,13 void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt | |||
|
382 | 385 | |
|
383 | 386 | reversePainter(painter, clipRect); |
|
384 | 387 | |
|
385 | if (m_pointLabelsVisible) | |
|
388 | if (m_pointLabelsVisible) { | |
|
389 | if (m_pointLabelsClipping) | |
|
390 | painter->setClipping(true); | |
|
391 | else | |
|
392 | painter->setClipping(false); | |
|
386 | 393 | m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2); |
|
394 | } | |
|
387 | 395 | |
|
388 | 396 | painter->restore(); |
|
389 | 397 |
@@ -84,6 +84,7 private: | |||
|
84 | 84 | QString m_pointLabelsFormat; |
|
85 | 85 | QFont m_pointLabelsFont; |
|
86 | 86 | QColor m_pointLabelsColor; |
|
87 | bool m_pointLabelsClipping; | |
|
87 | 88 | |
|
88 | 89 | QPointF m_lastMousePos; |
|
89 | 90 | bool m_mousePressed; |
@@ -40,6 +40,7 ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item) | |||
|
40 | 40 | m_pointLabelsFormat(series->pointLabelsFormat()), |
|
41 | 41 | m_pointLabelsFont(series->pointLabelsFont()), |
|
42 | 42 | m_pointLabelsColor(series->pointLabelsColor()), |
|
43 | m_pointLabelsClipping(true), | |
|
43 | 44 | m_mousePressed(false) |
|
44 | 45 | { |
|
45 | 46 | QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated())); |
@@ -51,6 +52,7 ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item) | |||
|
51 | 52 | this, SLOT(handleUpdated())); |
|
52 | 53 | QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated())); |
|
53 | 54 | QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); |
|
55 | QObject::connect(series, SIGNAL(pointLabelsClippingChanged(bool)), this, SLOT(handleUpdated())); | |
|
54 | 56 | |
|
55 | 57 | setZValue(ChartPresenter::ScatterSeriesZValue); |
|
56 | 58 | setFlags(QGraphicsItem::ItemClipsChildrenToShape); |
@@ -203,6 +205,10 void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * | |||
|
203 | 205 | painter->setClipRect(clipRect); |
|
204 | 206 | |
|
205 | 207 | if (m_pointLabelsVisible) { |
|
208 | if (m_pointLabelsClipping) | |
|
209 | painter->setClipping(true); | |
|
210 | else | |
|
211 | painter->setClipping(false); | |
|
206 | 212 | m_series->d_func()->drawSeriesPointLabels(painter, m_points, |
|
207 | 213 | m_series->markerSize() / 2 |
|
208 | 214 | + m_series->pen().width()); |
@@ -242,6 +248,7 void ScatterChartItem::handleUpdated() | |||
|
242 | 248 | m_pointLabelsVisible = m_series->pointLabelsVisible(); |
|
243 | 249 | m_pointLabelsFont = m_series->pointLabelsFont(); |
|
244 | 250 | m_pointLabelsColor = m_series->pointLabelsColor(); |
|
251 | m_pointLabelsClipping = m_series->pointLabelsClipping(); | |
|
245 | 252 | |
|
246 | 253 | if (recreate) { |
|
247 | 254 | deletePoints(count); |
@@ -86,6 +86,7 private: | |||
|
86 | 86 | QString m_pointLabelsFormat; |
|
87 | 87 | QFont m_pointLabelsFont; |
|
88 | 88 | QColor m_pointLabelsColor; |
|
89 | bool m_pointLabelsClipping; | |
|
89 | 90 | |
|
90 | 91 | bool m_mousePressed; |
|
91 | 92 | }; |
@@ -35,6 +35,7 SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item) | |||
|
35 | 35 | m_pointLabelsFormat(series->pointLabelsFormat()), |
|
36 | 36 | m_pointLabelsFont(series->pointLabelsFont()), |
|
37 | 37 | m_pointLabelsColor(series->pointLabelsColor()), |
|
38 | m_pointLabelsClipping(true), | |
|
38 | 39 | m_mousePressed(false) |
|
39 | 40 | { |
|
40 | 41 | setAcceptHoverEvents(true); |
@@ -49,6 +50,7 SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item) | |||
|
49 | 50 | this, SLOT(handleUpdated())); |
|
50 | 51 | QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated())); |
|
51 | 52 | QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); |
|
53 | QObject::connect(series, SIGNAL(pointLabelsClippingChanged(bool)), this, SLOT(handleUpdated())); | |
|
52 | 54 | handleUpdated(); |
|
53 | 55 | } |
|
54 | 56 | |
@@ -414,6 +416,7 void SplineChartItem::handleUpdated() | |||
|
414 | 416 | m_pointLabelsVisible = m_series->pointLabelsVisible(); |
|
415 | 417 | m_pointLabelsFont = m_series->pointLabelsFont(); |
|
416 | 418 | m_pointLabelsColor = m_series->pointLabelsColor(); |
|
419 | m_pointLabelsClipping = m_series->pointLabelsClipping(); | |
|
417 | 420 | update(); |
|
418 | 421 | } |
|
419 | 422 | |
@@ -460,8 +463,13 void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o | |||
|
460 | 463 | |
|
461 | 464 | reversePainter(painter, clipRect); |
|
462 | 465 | |
|
463 | if (m_pointLabelsVisible) | |
|
466 | if (m_pointLabelsVisible) { | |
|
467 | if (m_pointLabelsClipping) | |
|
468 | painter->setClipping(true); | |
|
469 | else | |
|
470 | painter->setClipping(false); | |
|
464 | 471 | m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2); |
|
472 | } | |
|
465 | 473 | |
|
466 | 474 | painter->restore(); |
|
467 | 475 | } |
@@ -85,6 +85,7 private: | |||
|
85 | 85 | QString m_pointLabelsFormat; |
|
86 | 86 | QFont m_pointLabelsFont; |
|
87 | 87 | QColor m_pointLabelsColor; |
|
88 | bool m_pointLabelsClipping; | |
|
88 | 89 | |
|
89 | 90 | QPointF m_lastMousePos; |
|
90 | 91 | bool m_mousePressed; |
@@ -162,13 +162,13 QT_CHARTS_BEGIN_NAMESPACE | |||
|
162 | 162 | \property QXYSeries::pointLabelsVisible |
|
163 | 163 | Defines the visibility for data point labels. False by default. |
|
164 | 164 | |
|
165 | \sa pointLabelsFormat | |
|
165 | \sa pointLabelsFormat, pointLabelsClipping | |
|
166 | 166 | */ |
|
167 | 167 | /*! |
|
168 | 168 | \qmlproperty bool XYSeries::pointLabelsVisible |
|
169 | 169 | Defines the visibility for data point labels. |
|
170 | 170 | |
|
171 | \sa pointLabelsFormat | |
|
171 | \sa pointLabelsFormat, pointLabelsClipping | |
|
172 | 172 | */ |
|
173 | 173 | /*! |
|
174 | 174 | \fn void QXYSeries::pointLabelsVisibilityChanged(bool visible) |
@@ -224,6 +224,29 QT_CHARTS_BEGIN_NAMESPACE | |||
|
224 | 224 | */ |
|
225 | 225 | |
|
226 | 226 | /*! |
|
227 | \property QXYSeries::pointLabelsClipping | |
|
228 | Defines the clipping for data point labels. True by default. The labels on the edge of the plot | |
|
229 | area are cut when clipping is enabled. | |
|
230 | ||
|
231 | \sa pointLabelsVisible | |
|
232 | */ | |
|
233 | /*! | |
|
234 | \qmlproperty bool XYSeries::pointLabelsClipping | |
|
235 | Defines the clipping for data point labels. True by default. The labels on the edge of the plot | |
|
236 | area are cut when clipping is enabled. | |
|
237 | ||
|
238 | \sa pointLabelsVisible | |
|
239 | */ | |
|
240 | /*! | |
|
241 | \fn void QXYSeries::pointLabelsClippintChanged(bool clipping) | |
|
242 | The clipping of the data point labels is changed to \a clipping. | |
|
243 | */ | |
|
244 | /*! | |
|
245 | \qmlsignal XYSeries::onPointLabelsClippingChanged(bool clipping) | |
|
246 | The clipping of the data point labels is changed to \a clipping. | |
|
247 | */ | |
|
248 | ||
|
249 | /*! | |
|
227 | 250 | \fn void QXYSeries::clicked(const QPointF& point) |
|
228 | 251 | \brief Signal is emitted when user clicks the \a point on chart. The \a point is the point |
|
229 | 252 | where the press was triggered. |
@@ -779,6 +802,21 QColor QXYSeries::pointLabelsColor() const | |||
|
779 | 802 | return d->m_pointLabelsColor; |
|
780 | 803 | } |
|
781 | 804 | |
|
805 | void QXYSeries::setPointLabelsClipping(bool enabled) | |
|
806 | { | |
|
807 | Q_D(QXYSeries); | |
|
808 | if (d->m_pointLabelsClipping != enabled) { | |
|
809 | d->m_pointLabelsClipping = enabled; | |
|
810 | emit pointLabelsClippingChanged(enabled); | |
|
811 | } | |
|
812 | } | |
|
813 | ||
|
814 | bool QXYSeries::pointLabelsClipping() const | |
|
815 | { | |
|
816 | Q_D(const QXYSeries); | |
|
817 | return d->m_pointLabelsClipping; | |
|
818 | } | |
|
819 | ||
|
782 | 820 | /*! |
|
783 | 821 | Stream operator for adding a data \a point to the series. |
|
784 | 822 | \sa append() |
@@ -812,7 +850,8 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q) | |||
|
812 | 850 | m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")), |
|
813 | 851 | m_pointLabelsVisible(false), |
|
814 | 852 | m_pointLabelsFont(QChartPrivate::defaultFont()), |
|
815 | m_pointLabelsColor(QChartPrivate::defaultPen().color()) | |
|
853 | m_pointLabelsColor(QChartPrivate::defaultPen().color()), | |
|
854 | m_pointLabelsClipping(true) | |
|
816 | 855 | { |
|
817 | 856 | } |
|
818 | 857 |
@@ -42,6 +42,7 class QT_CHARTS_EXPORT QXYSeries : public QAbstractSeries | |||
|
42 | 42 | Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged) |
|
43 | 43 | Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged) |
|
44 | 44 | Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged) |
|
45 | Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged) | |
|
45 | 46 | |
|
46 | 47 | protected: |
|
47 | 48 | explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0); |
@@ -93,6 +94,9 public: | |||
|
93 | 94 | void setPointLabelsColor(const QColor &color); |
|
94 | 95 | QColor pointLabelsColor() const; |
|
95 | 96 | |
|
97 | void setPointLabelsClipping(bool enabled = true); | |
|
98 | bool pointLabelsClipping() const; | |
|
99 | ||
|
96 | 100 | void replace(QList<QPointF> points); |
|
97 | 101 | void replace(QVector<QPointF> points); |
|
98 | 102 | |
@@ -111,6 +115,7 Q_SIGNALS: | |||
|
111 | 115 | void pointLabelsVisibilityChanged(bool visible); |
|
112 | 116 | void pointLabelsFontChanged(const QFont &font); |
|
113 | 117 | void pointLabelsColorChanged(const QColor &color); |
|
118 | void pointLabelsClippingChanged(bool clipping); | |
|
114 | 119 | void pointsRemoved(int index, int count); |
|
115 | 120 | |
|
116 | 121 | private: |
@@ -67,6 +67,7 protected: | |||
|
67 | 67 | bool m_pointLabelsVisible; |
|
68 | 68 | QFont m_pointLabelsFont; |
|
69 | 69 | QColor m_pointLabelsColor; |
|
70 | bool m_pointLabelsClipping; | |
|
70 | 71 | |
|
71 | 72 | private: |
|
72 | 73 | Q_DECLARE_PUBLIC(QXYSeries) |
@@ -2256,6 +2256,7 Module { | |||
|
2256 | 2256 | Property { name: "pointLabelsVisible"; type: "bool" } |
|
2257 | 2257 | Property { name: "pointLabelsFont"; type: "QFont" } |
|
2258 | 2258 | Property { name: "pointLabelsColor"; type: "QColor" } |
|
2259 | Property { name: "pointLabelsClipping"; type: "bool" } | |
|
2259 | 2260 | Signal { |
|
2260 | 2261 | name: "clicked" |
|
2261 | 2262 | Parameter { name: "point"; type: "QPointF" } |
@@ -2302,6 +2303,10 Module { | |||
|
2302 | 2303 | name: "pointLabelsColorChanged" |
|
2303 | 2304 | Parameter { name: "color"; type: "QColor" } |
|
2304 | 2305 | } |
|
2306 | Signal { | |
|
2307 | name: "pointLabelsClippingChanged" | |
|
2308 | Parameter { name: "clipping"; type: "bool" } | |
|
2309 | } | |
|
2305 | 2310 | } |
|
2306 | 2311 | Component { |
|
2307 | 2312 | name: "QtCharts::QBarCategoryAxis" |
@@ -2899,6 +2904,7 Module { | |||
|
2899 | 2904 | Property { name: "pointLabelsVisible"; type: "bool" } |
|
2900 | 2905 | Property { name: "pointLabelsFont"; type: "QFont" } |
|
2901 | 2906 | Property { name: "pointLabelsColor"; type: "QColor" } |
|
2907 | Property { name: "pointLabelsClipping"; type: "bool" } | |
|
2902 | 2908 | Signal { |
|
2903 | 2909 | name: "clicked" |
|
2904 | 2910 | Parameter { name: "point"; type: "QPointF" } |
@@ -2954,6 +2960,10 Module { | |||
|
2954 | 2960 | Parameter { name: "color"; type: "QColor" } |
|
2955 | 2961 | } |
|
2956 | 2962 | Signal { |
|
2963 | name: "pointLabelsClippingChanged" | |
|
2964 | Parameter { name: "clipping"; type: "bool" } | |
|
2965 | } | |
|
2966 | Signal { | |
|
2957 | 2967 | name: "pointsRemoved" |
|
2958 | 2968 | Parameter { name: "index"; type: "int" } |
|
2959 | 2969 | Parameter { name: "count"; type: "int" } |
@@ -80,6 +80,7 void tst_QLineSeries::qlineseries() | |||
|
80 | 80 | QCOMPARE(series.pointsVisible(), false); |
|
81 | 81 | QCOMPARE(series.pointLabelsVisible(), false); |
|
82 | 82 | QCOMPARE(series.pointLabelsFormat(), QLatin1String("@xPoint, @yPoint")); |
|
83 | QCOMPARE(series.pointLabelsClipping(), true); | |
|
83 | 84 | |
|
84 | 85 | series.append(QList<QPointF>()); |
|
85 | 86 | series.append(0.0,0.0); |
@@ -152,6 +152,24 void tst_QXYSeries::pointLabelsColor() | |||
|
152 | 152 | QVERIFY(arguments.at(0).value<QColor>() == defaultColor); |
|
153 | 153 | } |
|
154 | 154 | |
|
155 | void tst_QXYSeries::pointLabelsClipping() | |
|
156 | { | |
|
157 | QSignalSpy labelsClippingSpy(m_series, SIGNAL(pointLabelsClippingChanged(bool))); | |
|
158 | QCOMPARE(m_series->pointLabelsClipping(), true); | |
|
159 | ||
|
160 | m_series->setPointLabelsClipping(false); | |
|
161 | QCOMPARE(m_series->pointLabelsClipping(), false); | |
|
162 | TRY_COMPARE(labelsClippingSpy.count(), 1); | |
|
163 | QList<QVariant> arguments = labelsClippingSpy.takeFirst(); | |
|
164 | QVERIFY(arguments.at(0).toBool() == false); | |
|
165 | ||
|
166 | m_series->setPointLabelsClipping(); | |
|
167 | QCOMPARE(m_series->pointLabelsClipping(), true); | |
|
168 | TRY_COMPARE(labelsClippingSpy.count(), 1); | |
|
169 | arguments = labelsClippingSpy.takeFirst(); | |
|
170 | QVERIFY(arguments.at(0).toBool() == true); | |
|
171 | } | |
|
172 | ||
|
155 | 173 | void tst_QXYSeries::append_data() |
|
156 | 174 | { |
|
157 | 175 | QTest::addColumn< QList<QPointF> >("points"); |
@@ -44,6 +44,7 private slots: | |||
|
44 | 44 | void pointLabelsVisible(); |
|
45 | 45 | void pointLabelsFont(); |
|
46 | 46 | void pointLabelsColor(); |
|
47 | void pointLabelsClipping(); | |
|
47 | 48 | void seriesOpacity(); |
|
48 | 49 | void oper_data(); |
|
49 | 50 | void oper(); |
@@ -79,6 +79,8 ChartView { | |||
|
79 | 79 | + font.family); |
|
80 | 80 | onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: " |
|
81 | 81 | + color); |
|
82 | onPointLabelsClippingChanged: console.log(name + ".onPointLabelsClippingChanged: " | |
|
83 | + clipping); | |
|
82 | 84 | onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); |
|
83 | 85 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); |
|
84 | 86 | onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); |
@@ -79,6 +79,10 Flow { | |||
|
79 | 79 | onClicked: series.pointLabelsColor = main.nextColor(); |
|
80 | 80 | } |
|
81 | 81 | Button { |
|
82 | text: "point labels clipping" | |
|
83 | onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; | |
|
84 | } | |
|
85 | Button { | |
|
82 | 86 | id: upperButton |
|
83 | 87 | text: "upper series" |
|
84 | 88 | unpressedColor: "#79bd8f" |
@@ -60,6 +60,8 ChartView { | |||
|
60 | 60 | + font.family); |
|
61 | 61 | onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: " |
|
62 | 62 | + color); |
|
63 | onPointLabelsClippingChanged: console.log("lineSeries.onPointLabelsClippingChanged: " | |
|
64 | + clipping); | |
|
63 | 65 | onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); |
|
64 | 66 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); |
|
65 | 67 | onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); |
@@ -96,6 +96,10 Flow { | |||
|
96 | 96 | onClicked: series.pointLabelsColor = main.nextColor(); |
|
97 | 97 | } |
|
98 | 98 | Button { |
|
99 | text: "point labels clipping" | |
|
100 | onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; | |
|
101 | } | |
|
102 | Button { | |
|
99 | 103 | text: "append point" |
|
100 | 104 | onClicked: series.append(series.count - 1, series.count - 1); |
|
101 | 105 | } |
@@ -57,6 +57,8 ChartView { | |||
|
57 | 57 | + font.family); |
|
58 | 58 | onPointLabelsColorChanged: console.log("scatterSeries.onPointLabelsColorChanged: " |
|
59 | 59 | + color); |
|
60 | onPointLabelsClippingChanged: console.log("scatterSeries.onPointLabelsClippingChanged: " | |
|
61 | + clipping); | |
|
60 | 62 | onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); |
|
61 | 63 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); |
|
62 | 64 | onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); |
@@ -69,6 +69,10 Flow { | |||
|
69 | 69 | onClicked: series.pointLabelsVisible = !series.pointLabelsVisible; |
|
70 | 70 | } |
|
71 | 71 | Button { |
|
72 | text: "point labels clipping" | |
|
73 | onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; | |
|
74 | } | |
|
75 | Button { | |
|
72 | 76 | text: "point labels format" |
|
73 | 77 | onClicked: { |
|
74 | 78 | if (series.pointLabelsFormat === "@xPoint, @yPoint") |
@@ -91,6 +95,10 Flow { | |||
|
91 | 95 | onClicked: series.pointLabelsColor = main.nextColor(); |
|
92 | 96 | } |
|
93 | 97 | Button { |
|
98 | text: "point labels clipping" | |
|
99 | onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; | |
|
100 | } | |
|
101 | Button { | |
|
94 | 102 | text: "append point" |
|
95 | 103 | onClicked: series.append(series.count - 1, series.count - 1); |
|
96 | 104 | } |
@@ -59,6 +59,8 ChartView { | |||
|
59 | 59 | + font.family); |
|
60 | 60 | onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: " |
|
61 | 61 | + color); |
|
62 | onPointLabelsClippingChanged: console.log("splineSeries.onPointLabelsClippingChanged: " | |
|
63 | + clipping); | |
|
62 | 64 | onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); |
|
63 | 65 | onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); |
|
64 | 66 | onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); |
General Comments 0
You need to be logged in to leave comments.
Login now