From 4c1d3bc34edbea5f7ed8f145d4c11198b7610a53 2015-09-22 08:38:25 From: Titta Heikkala Date: 2015-09-22 08:38:25 Subject: [PATCH] Added option to set labels clipping It's now possible to enable and disable the point label clipping. The clipping is enabled by default. Clipping cuts the point labels on the edge of the plot area. Change-Id: Ifaa6017b4c6d55fe030effeec8b336a7fc317adf Task-number: QTRD-3520 Reviewed-by: Miikka Heikkinen --- diff --git a/src/charts/areachart/areachartitem.cpp b/src/charts/areachart/areachartitem.cpp index fea5913..f9f7bfc 100644 --- a/src/charts/areachart/areachartitem.cpp +++ b/src/charts/areachart/areachartitem.cpp @@ -39,6 +39,7 @@ AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) m_pointLabelsFormat(areaSeries->pointLabelsFormat()), m_pointLabelsFont(areaSeries->pointLabelsFont()), m_pointLabelsColor(areaSeries->pointLabelsColor()), + m_pointLabelsClipping(true), m_mousePressed(false) { setAcceptHoverEvents(true); @@ -66,6 +67,8 @@ AreaChartItem::AreaChartItem(QAreaSeries *areaSeries, QGraphicsItem* item) this, SLOT(handleUpdated())); QObject::connect(areaSeries, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); + QObject::connect(areaSeries, SIGNAL(pointLabelsClippingChanged(bool)), + this, SLOT(handleUpdated())); handleUpdated(); } @@ -151,6 +154,7 @@ void AreaChartItem::handleUpdated() m_pointLabelsVisible = m_series->pointLabelsVisible(); m_pointLabelsFont = m_series->pointLabelsFont(); m_pointLabelsColor = m_series->pointLabelsColor(); + m_pointLabelsClipping = m_series->pointLabelsClipping(); update(); } @@ -202,6 +206,11 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt static const QString yPointTag(QLatin1String("@yPoint")); const int labelOffset = 2; + if (m_pointLabelsClipping) + painter->setClipping(true); + else + painter->setClipping(false); + painter->setFont(m_pointLabelsFont); painter->setPen(QPen(m_pointLabelsColor)); QFontMetrics fm(painter->font()); diff --git a/src/charts/areachart/areachartitem_p.h b/src/charts/areachart/areachartitem_p.h index 7578513..485fdff 100644 --- a/src/charts/areachart/areachartitem_p.h +++ b/src/charts/areachart/areachartitem_p.h @@ -90,6 +90,7 @@ private: QString m_pointLabelsFormat; QFont m_pointLabelsFont; QColor m_pointLabelsColor; + bool m_pointLabelsClipping; QPointF m_lastMousePos; bool m_mousePressed; diff --git a/src/charts/areachart/qareaseries.cpp b/src/charts/areachart/qareaseries.cpp index 4d08087..a33db92 100644 --- a/src/charts/areachart/qareaseries.cpp +++ b/src/charts/areachart/qareaseries.cpp @@ -269,13 +269,13 @@ QT_CHARTS_BEGIN_NAMESPACE \property QAreaSeries::pointLabelsVisible Defines the visibility for data point labels. False by default. - \sa QAreaSeries::pointLabelsFormat + \sa QAreaSeries::pointLabelsFormat, QAreaSeries::pointLabelsClipping */ /*! \qmlproperty bool AreaSeries::pointLabelsVisible Defines the visibility for data point labels. - \sa pointLabelsFormat + \sa pointLabelsFormat, pointLabelsClipping */ /*! \fn void QAreaSeries::pointLabelsVisibilityChanged(bool visible) @@ -331,6 +331,29 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! + \property QAreaSeries::pointLabelsClipping + Defines the clipping for data point labels. True by default. The labels on the edge of the plot + area are cut when clipping is enabled. + + \sa pointLabelsVisible +*/ +/*! + \qmlproperty bool AreaSeries::pointLabelsClipping + Defines the clipping for data point labels. True by default. The labels on the edge of the plot + area are cut when clipping is enabled. + + \sa pointLabelsVisible +*/ +/*! + \fn void QAreaSeries::pointLabelsClippintChanged(bool clipping) + The clipping of the data point labels is changed to \a clipping. +*/ +/*! + \qmlsignal AreaSeries::onPointLabelsClippingChanged(bool clipping) + The clipping of the data point labels is changed to \a clipping. +*/ + +/*! Constructs area series object which is a child of \a upperSeries. Area will be spanned between \a upperSeries line and \a lowerSeries line. If no \a lowerSeries is passed to constructor, area is specified by axis x (y=0) instead. When series object is added to QChartView or QChart instance ownerships is transferred. @@ -556,6 +579,21 @@ QColor QAreaSeries::pointLabelsColor() const return d->m_pointLabelsColor; } +void QAreaSeries::setPointLabelsClipping(bool enabled) +{ + Q_D(QAreaSeries); + if (d->m_pointLabelsClipping != enabled) { + d->m_pointLabelsClipping = enabled; + emit pointLabelsClippingChanged(enabled); + } +} + +bool QAreaSeries::pointLabelsClipping() const +{ + Q_D(const QAreaSeries); + return d->m_pointLabelsClipping; +} + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q) @@ -568,7 +606,8 @@ QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lo m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")), m_pointLabelsVisible(false), m_pointLabelsFont(QChartPrivate::defaultFont()), - m_pointLabelsColor(QChartPrivate::defaultPen().color()) + m_pointLabelsColor(QChartPrivate::defaultPen().color()), + m_pointLabelsClipping(true) { } diff --git a/src/charts/areachart/qareaseries.h b/src/charts/areachart/qareaseries.h index f977053..3a70d04 100644 --- a/src/charts/areachart/qareaseries.h +++ b/src/charts/areachart/qareaseries.h @@ -39,6 +39,7 @@ class QT_CHARTS_EXPORT QAreaSeries : public QAbstractSeries Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged) Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged) Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged) + Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged) public: explicit QAreaSeries(QObject *parent = 0); @@ -80,6 +81,9 @@ public: void setPointLabelsColor(const QColor &color); QColor pointLabelsColor() const; + void setPointLabelsClipping(bool enabled = true); + bool pointLabelsClipping() const; + Q_SIGNALS: void clicked(const QPointF &point); void hovered(const QPointF &point, bool state); @@ -93,6 +97,7 @@ Q_SIGNALS: void pointLabelsVisibilityChanged(bool visible); void pointLabelsFontChanged(const QFont &font); void pointLabelsColorChanged(const QColor &color); + void pointLabelsClippingChanged(bool clipping); private: Q_DECLARE_PRIVATE(QAreaSeries) diff --git a/src/charts/areachart/qareaseries_p.h b/src/charts/areachart/qareaseries_p.h index 10e6d99..def20da 100644 --- a/src/charts/areachart/qareaseries_p.h +++ b/src/charts/areachart/qareaseries_p.h @@ -67,6 +67,8 @@ protected: bool m_pointLabelsVisible; QFont m_pointLabelsFont; QColor m_pointLabelsColor; + bool m_pointLabelsClipping; + private: Q_DECLARE_PUBLIC(QAreaSeries); }; diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp index 54f1323..ba39098 100644 --- a/src/charts/linechart/linechartitem.cpp +++ b/src/charts/linechart/linechartitem.cpp @@ -39,6 +39,7 @@ LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item) m_pointLabelsFormat(series->pointLabelsFormat()), m_pointLabelsFont(series->pointLabelsFont()), m_pointLabelsColor(series->pointLabelsColor()), + m_pointLabelsClipping(true), m_mousePressed(false) { setAcceptHoverEvents(true); @@ -53,6 +54,7 @@ LineChartItem::LineChartItem(QLineSeries *series, QGraphicsItem *item) this, SLOT(handleUpdated())); QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated())); QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); + QObject::connect(series, SIGNAL(pointLabelsClippingChanged(bool)), this, SLOT(handleUpdated())); handleUpdated(); } @@ -330,6 +332,7 @@ void LineChartItem::handleUpdated() m_pointLabelsVisible = m_series->pointLabelsVisible(); m_pointLabelsFont = m_series->pointLabelsFont(); m_pointLabelsColor = m_series->pointLabelsColor(); + m_pointLabelsClipping = m_series->pointLabelsClipping(); if (doGeometryUpdate) updateGeometry(); update(); @@ -382,8 +385,13 @@ void LineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt reversePainter(painter, clipRect); - if (m_pointLabelsVisible) + if (m_pointLabelsVisible) { + if (m_pointLabelsClipping) + painter->setClipping(true); + else + painter->setClipping(false); m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2); + } painter->restore(); diff --git a/src/charts/linechart/linechartitem_p.h b/src/charts/linechart/linechartitem_p.h index dd24f68..846ea78 100644 --- a/src/charts/linechart/linechartitem_p.h +++ b/src/charts/linechart/linechartitem_p.h @@ -84,6 +84,7 @@ private: QString m_pointLabelsFormat; QFont m_pointLabelsFont; QColor m_pointLabelsColor; + bool m_pointLabelsClipping; QPointF m_lastMousePos; bool m_mousePressed; diff --git a/src/charts/scatterchart/scatterchartitem.cpp b/src/charts/scatterchart/scatterchartitem.cpp index 0889a0d..ac0611e 100644 --- a/src/charts/scatterchart/scatterchartitem.cpp +++ b/src/charts/scatterchart/scatterchartitem.cpp @@ -40,6 +40,7 @@ ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item) m_pointLabelsFormat(series->pointLabelsFormat()), m_pointLabelsFont(series->pointLabelsFont()), m_pointLabelsColor(series->pointLabelsColor()), + m_pointLabelsClipping(true), m_mousePressed(false) { QObject::connect(m_series->d_func(), SIGNAL(updated()), this, SLOT(handleUpdated())); @@ -51,6 +52,7 @@ ScatterChartItem::ScatterChartItem(QScatterSeries *series, QGraphicsItem *item) this, SLOT(handleUpdated())); QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated())); QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); + QObject::connect(series, SIGNAL(pointLabelsClippingChanged(bool)), this, SLOT(handleUpdated())); setZValue(ChartPresenter::ScatterSeriesZValue); setFlags(QGraphicsItem::ItemClipsChildrenToShape); @@ -203,6 +205,10 @@ void ScatterChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * painter->setClipRect(clipRect); if (m_pointLabelsVisible) { + if (m_pointLabelsClipping) + painter->setClipping(true); + else + painter->setClipping(false); m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_series->markerSize() / 2 + m_series->pen().width()); @@ -242,6 +248,7 @@ void ScatterChartItem::handleUpdated() m_pointLabelsVisible = m_series->pointLabelsVisible(); m_pointLabelsFont = m_series->pointLabelsFont(); m_pointLabelsColor = m_series->pointLabelsColor(); + m_pointLabelsClipping = m_series->pointLabelsClipping(); if (recreate) { deletePoints(count); diff --git a/src/charts/scatterchart/scatterchartitem_p.h b/src/charts/scatterchart/scatterchartitem_p.h index 080d84e..faba1f2 100644 --- a/src/charts/scatterchart/scatterchartitem_p.h +++ b/src/charts/scatterchart/scatterchartitem_p.h @@ -86,6 +86,7 @@ private: QString m_pointLabelsFormat; QFont m_pointLabelsFont; QColor m_pointLabelsColor; + bool m_pointLabelsClipping; bool m_mousePressed; }; diff --git a/src/charts/splinechart/splinechartitem.cpp b/src/charts/splinechart/splinechartitem.cpp index 752658d..3389645 100644 --- a/src/charts/splinechart/splinechartitem.cpp +++ b/src/charts/splinechart/splinechartitem.cpp @@ -35,6 +35,7 @@ SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item) m_pointLabelsFormat(series->pointLabelsFormat()), m_pointLabelsFont(series->pointLabelsFont()), m_pointLabelsColor(series->pointLabelsColor()), + m_pointLabelsClipping(true), m_mousePressed(false) { setAcceptHoverEvents(true); @@ -49,6 +50,7 @@ SplineChartItem::SplineChartItem(QSplineSeries *series, QGraphicsItem *item) this, SLOT(handleUpdated())); QObject::connect(series, SIGNAL(pointLabelsFontChanged(QFont)), this, SLOT(handleUpdated())); QObject::connect(series, SIGNAL(pointLabelsColorChanged(QColor)), this, SLOT(handleUpdated())); + QObject::connect(series, SIGNAL(pointLabelsClippingChanged(bool)), this, SLOT(handleUpdated())); handleUpdated(); } @@ -414,6 +416,7 @@ void SplineChartItem::handleUpdated() m_pointLabelsVisible = m_series->pointLabelsVisible(); m_pointLabelsFont = m_series->pointLabelsFont(); m_pointLabelsColor = m_series->pointLabelsColor(); + m_pointLabelsClipping = m_series->pointLabelsClipping(); update(); } @@ -460,8 +463,13 @@ void SplineChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o reversePainter(painter, clipRect); - if (m_pointLabelsVisible) + if (m_pointLabelsVisible) { + if (m_pointLabelsClipping) + painter->setClipping(true); + else + painter->setClipping(false); m_series->d_func()->drawSeriesPointLabels(painter, m_points, m_linePen.width() / 2); + } painter->restore(); } diff --git a/src/charts/splinechart/splinechartitem_p.h b/src/charts/splinechart/splinechartitem_p.h index fa3a68c..241f26c 100644 --- a/src/charts/splinechart/splinechartitem_p.h +++ b/src/charts/splinechart/splinechartitem_p.h @@ -85,6 +85,7 @@ private: QString m_pointLabelsFormat; QFont m_pointLabelsFont; QColor m_pointLabelsColor; + bool m_pointLabelsClipping; QPointF m_lastMousePos; bool m_mousePressed; diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp index c431f8a..a88c5f8 100644 --- a/src/charts/xychart/qxyseries.cpp +++ b/src/charts/xychart/qxyseries.cpp @@ -162,13 +162,13 @@ QT_CHARTS_BEGIN_NAMESPACE \property QXYSeries::pointLabelsVisible Defines the visibility for data point labels. False by default. - \sa pointLabelsFormat + \sa pointLabelsFormat, pointLabelsClipping */ /*! \qmlproperty bool XYSeries::pointLabelsVisible Defines the visibility for data point labels. - \sa pointLabelsFormat + \sa pointLabelsFormat, pointLabelsClipping */ /*! \fn void QXYSeries::pointLabelsVisibilityChanged(bool visible) @@ -224,6 +224,29 @@ QT_CHARTS_BEGIN_NAMESPACE */ /*! + \property QXYSeries::pointLabelsClipping + Defines the clipping for data point labels. True by default. The labels on the edge of the plot + area are cut when clipping is enabled. + + \sa pointLabelsVisible +*/ +/*! + \qmlproperty bool XYSeries::pointLabelsClipping + Defines the clipping for data point labels. True by default. The labels on the edge of the plot + area are cut when clipping is enabled. + + \sa pointLabelsVisible +*/ +/*! + \fn void QXYSeries::pointLabelsClippintChanged(bool clipping) + The clipping of the data point labels is changed to \a clipping. +*/ +/*! + \qmlsignal XYSeries::onPointLabelsClippingChanged(bool clipping) + The clipping of the data point labels is changed to \a clipping. +*/ + +/*! \fn void QXYSeries::clicked(const QPointF& point) \brief Signal is emitted when user clicks the \a point on chart. The \a point is the point where the press was triggered. @@ -779,6 +802,21 @@ QColor QXYSeries::pointLabelsColor() const return d->m_pointLabelsColor; } +void QXYSeries::setPointLabelsClipping(bool enabled) +{ + Q_D(QXYSeries); + if (d->m_pointLabelsClipping != enabled) { + d->m_pointLabelsClipping = enabled; + emit pointLabelsClippingChanged(enabled); + } +} + +bool QXYSeries::pointLabelsClipping() const +{ + Q_D(const QXYSeries); + return d->m_pointLabelsClipping; +} + /*! Stream operator for adding a data \a point to the series. \sa append() @@ -812,7 +850,8 @@ QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q) m_pointLabelsFormat(QLatin1String("@xPoint, @yPoint")), m_pointLabelsVisible(false), m_pointLabelsFont(QChartPrivate::defaultFont()), - m_pointLabelsColor(QChartPrivate::defaultPen().color()) + m_pointLabelsColor(QChartPrivate::defaultPen().color()), + m_pointLabelsClipping(true) { } diff --git a/src/charts/xychart/qxyseries.h b/src/charts/xychart/qxyseries.h index ceba5de..6a211fb 100644 --- a/src/charts/xychart/qxyseries.h +++ b/src/charts/xychart/qxyseries.h @@ -42,6 +42,7 @@ class QT_CHARTS_EXPORT QXYSeries : public QAbstractSeries Q_PROPERTY(bool pointLabelsVisible READ pointLabelsVisible WRITE setPointLabelsVisible NOTIFY pointLabelsVisibilityChanged) Q_PROPERTY(QFont pointLabelsFont READ pointLabelsFont WRITE setPointLabelsFont NOTIFY pointLabelsFontChanged) Q_PROPERTY(QColor pointLabelsColor READ pointLabelsColor WRITE setPointLabelsColor NOTIFY pointLabelsColorChanged) + Q_PROPERTY(bool pointLabelsClipping READ pointLabelsClipping WRITE setPointLabelsClipping NOTIFY pointLabelsClippingChanged) protected: explicit QXYSeries(QXYSeriesPrivate &d, QObject *parent = 0); @@ -93,6 +94,9 @@ public: void setPointLabelsColor(const QColor &color); QColor pointLabelsColor() const; + void setPointLabelsClipping(bool enabled = true); + bool pointLabelsClipping() const; + void replace(QList points); void replace(QVector points); @@ -111,6 +115,7 @@ Q_SIGNALS: void pointLabelsVisibilityChanged(bool visible); void pointLabelsFontChanged(const QFont &font); void pointLabelsColorChanged(const QColor &color); + void pointLabelsClippingChanged(bool clipping); void pointsRemoved(int index, int count); private: diff --git a/src/charts/xychart/qxyseries_p.h b/src/charts/xychart/qxyseries_p.h index 57f6ba4..9ec1c1e 100644 --- a/src/charts/xychart/qxyseries_p.h +++ b/src/charts/xychart/qxyseries_p.h @@ -67,6 +67,7 @@ protected: bool m_pointLabelsVisible; QFont m_pointLabelsFont; QColor m_pointLabelsColor; + bool m_pointLabelsClipping; private: Q_DECLARE_PUBLIC(QXYSeries) diff --git a/src/chartsqml2/plugins.qmltypes b/src/chartsqml2/plugins.qmltypes index 43f0faa..618e5e2 100644 --- a/src/chartsqml2/plugins.qmltypes +++ b/src/chartsqml2/plugins.qmltypes @@ -2256,6 +2256,7 @@ Module { Property { name: "pointLabelsVisible"; type: "bool" } Property { name: "pointLabelsFont"; type: "QFont" } Property { name: "pointLabelsColor"; type: "QColor" } + Property { name: "pointLabelsClipping"; type: "bool" } Signal { name: "clicked" Parameter { name: "point"; type: "QPointF" } @@ -2302,6 +2303,10 @@ Module { name: "pointLabelsColorChanged" Parameter { name: "color"; type: "QColor" } } + Signal { + name: "pointLabelsClippingChanged" + Parameter { name: "clipping"; type: "bool" } + } } Component { name: "QtCharts::QBarCategoryAxis" @@ -2899,6 +2904,7 @@ Module { Property { name: "pointLabelsVisible"; type: "bool" } Property { name: "pointLabelsFont"; type: "QFont" } Property { name: "pointLabelsColor"; type: "QColor" } + Property { name: "pointLabelsClipping"; type: "bool" } Signal { name: "clicked" Parameter { name: "point"; type: "QPointF" } @@ -2954,6 +2960,10 @@ Module { Parameter { name: "color"; type: "QColor" } } Signal { + name: "pointLabelsClippingChanged" + Parameter { name: "clipping"; type: "bool" } + } + Signal { name: "pointsRemoved" Parameter { name: "index"; type: "int" } Parameter { name: "count"; type: "int" } diff --git a/tests/auto/qlineseries/tst_qlineseries.cpp b/tests/auto/qlineseries/tst_qlineseries.cpp index f440630..e1df6c7 100644 --- a/tests/auto/qlineseries/tst_qlineseries.cpp +++ b/tests/auto/qlineseries/tst_qlineseries.cpp @@ -80,6 +80,7 @@ void tst_QLineSeries::qlineseries() QCOMPARE(series.pointsVisible(), false); QCOMPARE(series.pointLabelsVisible(), false); QCOMPARE(series.pointLabelsFormat(), QLatin1String("@xPoint, @yPoint")); + QCOMPARE(series.pointLabelsClipping(), true); series.append(QList()); series.append(0.0,0.0); diff --git a/tests/auto/qxyseries/tst_qxyseries.cpp b/tests/auto/qxyseries/tst_qxyseries.cpp index 337bc4e..bb82741 100644 --- a/tests/auto/qxyseries/tst_qxyseries.cpp +++ b/tests/auto/qxyseries/tst_qxyseries.cpp @@ -152,6 +152,24 @@ void tst_QXYSeries::pointLabelsColor() QVERIFY(arguments.at(0).value() == defaultColor); } +void tst_QXYSeries::pointLabelsClipping() +{ + QSignalSpy labelsClippingSpy(m_series, SIGNAL(pointLabelsClippingChanged(bool))); + QCOMPARE(m_series->pointLabelsClipping(), true); + + m_series->setPointLabelsClipping(false); + QCOMPARE(m_series->pointLabelsClipping(), false); + TRY_COMPARE(labelsClippingSpy.count(), 1); + QList arguments = labelsClippingSpy.takeFirst(); + QVERIFY(arguments.at(0).toBool() == false); + + m_series->setPointLabelsClipping(); + QCOMPARE(m_series->pointLabelsClipping(), true); + TRY_COMPARE(labelsClippingSpy.count(), 1); + arguments = labelsClippingSpy.takeFirst(); + QVERIFY(arguments.at(0).toBool() == true); +} + void tst_QXYSeries::append_data() { QTest::addColumn< QList >("points"); diff --git a/tests/auto/qxyseries/tst_qxyseries.h b/tests/auto/qxyseries/tst_qxyseries.h index 59a2c99..fca4a49 100644 --- a/tests/auto/qxyseries/tst_qxyseries.h +++ b/tests/auto/qxyseries/tst_qxyseries.h @@ -44,6 +44,7 @@ private slots: void pointLabelsVisible(); void pointLabelsFont(); void pointLabelsColor(); + void pointLabelsClipping(); void seriesOpacity(); void oper_data(); void oper(); diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml index 3f2a87b..020cbde 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaChart.qml @@ -79,6 +79,8 @@ ChartView { + font.family); onPointLabelsColorChanged: console.log(name + ".onPointLabelsColorChanged: " + color); + onPointLabelsClippingChanged: console.log(name + ".onPointLabelsClippingChanged: " + + clipping); onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml index 79cc84d..23ed70e 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/AreaEditor.qml @@ -79,6 +79,10 @@ Flow { onClicked: series.pointLabelsColor = main.nextColor(); } Button { + text: "point labels clipping" + onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; + } + Button { id: upperButton text: "upper series" unpressedColor: "#79bd8f" diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml index f1eaaa4..784a575 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineChart.qml @@ -60,6 +60,8 @@ ChartView { + font.family); onPointLabelsColorChanged: console.log("lineSeries.onPointLabelsColorChanged: " + color); + onPointLabelsClippingChanged: console.log("lineSeries.onPointLabelsClippingChanged: " + + clipping); onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml index a6390cb..c44f63e 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/LineEditor.qml @@ -96,6 +96,10 @@ Flow { onClicked: series.pointLabelsColor = main.nextColor(); } Button { + text: "point labels clipping" + onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; + } + Button { text: "append point" onClicked: series.append(series.count - 1, series.count - 1); } diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml index eada1aa..f957f02 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterChart.qml @@ -57,6 +57,8 @@ ChartView { + font.family); onPointLabelsColorChanged: console.log("scatterSeries.onPointLabelsColorChanged: " + color); + onPointLabelsClippingChanged: console.log("scatterSeries.onPointLabelsClippingChanged: " + + clipping); onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y); diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml index ce95cf5..4eca23c 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/ScatterEditor.qml @@ -69,6 +69,10 @@ Flow { onClicked: series.pointLabelsVisible = !series.pointLabelsVisible; } Button { + text: "point labels clipping" + onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; + } + Button { text: "point labels format" onClicked: { if (series.pointLabelsFormat === "@xPoint, @yPoint") @@ -91,6 +95,10 @@ Flow { onClicked: series.pointLabelsColor = main.nextColor(); } Button { + text: "point labels clipping" + onClicked: series.pointLabelsClipping = !series.pointLabelsClipping; + } + Button { text: "append point" onClicked: series.append(series.count - 1, series.count - 1); } diff --git a/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml b/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml index fe21688..0eaa47c 100644 --- a/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml +++ b/tests/manual/qmlchartproperties/qml/qmlchartproperties/SplineChart.qml @@ -59,6 +59,8 @@ ChartView { + font.family); onPointLabelsColorChanged: console.log("splineSeries.onPointLabelsColorChanged: " + color); + onPointLabelsClippingChanged: console.log("splineSeries.onPointLabelsClippingChanged: " + + clipping); onPressed: console.log(name + ".onPressed: " + point.x + ", " + point.y); onReleased: console.log(name + ".onReleased: " + point.x + ", " + point.y); onDoubleClicked: console.log(name + ".onDoubleClicked: " + point.x + ", " + point.y);