summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-06 15:01:32 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-02-06 14:50:37 +0000
commitc01b60a4882f256eea58ffc87d3aac9ce146f98d (patch)
treec6369b1aa4b48be6741850862bcdf20d68edd179
parent1347a8ea80373ba3f5859ad2381c514526d3faa4 (diff)
Fix some deprecation warningsv5.13.0-alpha1
xychart/qxyseries.cpp:1025:50: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] areachart/areachartitem.cpp:281:58: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] areachart/areachartitem.cpp:299:58: warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated: Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations] declarativecategoryaxis.cpp:86:57: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = QList<QPair<QString, double> >::iterator; LessThan = bool (*)(const QPair<QString, double>&, const QPair<QString, double>&)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] Change-Id: I0d7705be8690405a439e18ea0ddbfaef433037a4 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--examples/charts/boxplotchart/boxdatareader.cpp4
-rw-r--r--src/charts/areachart/areachartitem.cpp4
-rw-r--r--src/charts/legend/qlegend.cpp3
-rw-r--r--src/charts/xychart/qxyseries.cpp2
-rw-r--r--src/chartsqml2/declarativecategoryaxis.cpp4
5 files changed, 11 insertions, 6 deletions
diff --git a/examples/charts/boxplotchart/boxdatareader.cpp b/examples/charts/boxplotchart/boxdatareader.cpp
index 10591135..f634bd4e 100644
--- a/examples/charts/boxplotchart/boxdatareader.cpp
+++ b/examples/charts/boxplotchart/boxdatareader.cpp
@@ -29,6 +29,8 @@
#include "boxdatareader.h"
+#include <algorithm>
+
BoxDataReader::BoxDataReader(QIODevice *device) :
QTextStream(device)
{
@@ -56,7 +58,7 @@ QBoxSet *BoxDataReader::readBox()
for (int i = 1; i < strList.count(); i++)
sortedList.append(strList.at(i).toDouble());
- qSort(sortedList.begin(), sortedList.end());
+ std::sort(sortedList.begin(), sortedList.end());
//! [3]
int count = sortedList.count();
diff --git a/src/charts/areachart/areachartitem.cpp b/src/charts/areachart/areachartitem.cpp
index 58f2c367..e4ebf80a 100644
--- a/src/charts/areachart/areachartitem.cpp
+++ b/src/charts/areachart/areachartitem.cpp
@@ -278,7 +278,7 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
presenter()->numberToString(m_series->upperSeries()->at(i).y()));
// Position text in relation to the point
- int pointLabelWidth = fm.width(pointLabel);
+ int pointLabelWidth = fm.horizontalAdvance(pointLabel);
QPointF position(m_upper->geometryPoints().at(i));
position.setX(position.x() - pointLabelWidth / 2);
position.setY(position.y() - m_series->upperSeries()->pen().width() / 2
@@ -296,7 +296,7 @@ void AreaChartItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
presenter()->numberToString(m_series->lowerSeries()->at(i).y()));
// Position text in relation to the point
- int pointLabelWidth = fm.width(pointLabel);
+ int pointLabelWidth = fm.horizontalAdvance(pointLabel);
QPointF position(m_lower->geometryPoints().at(i));
position.setX(position.x() - pointLabelWidth / 2);
position.setY(position.y() - m_series->lowerSeries()->pen().width() / 2
diff --git a/src/charts/legend/qlegend.cpp b/src/charts/legend/qlegend.cpp
index 6cc9c7b6..6f5c2bb1 100644
--- a/src/charts/legend/qlegend.cpp
+++ b/src/charts/legend/qlegend.cpp
@@ -289,7 +289,8 @@ void QLegend::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, Q
painter->setOpacity(opacity());
painter->setPen(d_ptr->m_pen);
painter->setBrush(d_ptr->m_brush);
- painter->drawRoundRect(rect(), d_ptr->roundness(rect().width()), d_ptr->roundness(rect().height()));
+ painter->drawRoundedRect(rect(), d_ptr->roundness(rect().width()), d_ptr->roundness(rect().height()),
+ Qt::RelativeSize);
}
diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp
index 039fe247..a290f6d4 100644
--- a/src/charts/xychart/qxyseries.cpp
+++ b/src/charts/xychart/qxyseries.cpp
@@ -1022,7 +1022,7 @@ void QXYSeriesPrivate::drawSeriesPointLabels(QPainter *painter, const QVector<QP
pointLabel.replace(yPointTag, presenter()->numberToString(m_points.at(i).y()));
// Position text in relation to the point
- int pointLabelWidth = fm.width(pointLabel);
+ int pointLabelWidth = fm.horizontalAdvance(pointLabel);
QPointF position(points.at(i));
position.setX(position.x() - pointLabelWidth / 2);
position.setY(position.y() - labelOffset);
diff --git a/src/chartsqml2/declarativecategoryaxis.cpp b/src/chartsqml2/declarativecategoryaxis.cpp
index bf6afa58..1b1826fd 100644
--- a/src/chartsqml2/declarativecategoryaxis.cpp
+++ b/src/chartsqml2/declarativecategoryaxis.cpp
@@ -30,6 +30,8 @@
#include "declarativecategoryaxis_p.h"
#include <QtCore/QDebug>
+#include <algorithm>
+
QT_CHARTS_BEGIN_NAMESPACE
/*!
@@ -83,7 +85,7 @@ void DeclarativeCategoryAxis::componentComplete()
}
// Sort and append the range objects according to end value
- qSort(ranges.begin(), ranges.end(), endValueLessThan);
+ std::sort(ranges.begin(), ranges.end(), endValueLessThan);
for (int i(0); i < ranges.count(); i++)
append(ranges.at(i).first, ranges.at(i).second);
}