diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-11-11 16:26:04 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-11-18 22:01:54 +0100 |
commit | 0f8e133ce9af8c08a714c17d610c2b38a48ad346 (patch) | |
tree | 21896a25283b073b4c91221df8bdf675c8a294ca | |
parent | 9cb79cee780b478b26218a8c8f516f5c0a4fa7b6 (diff) |
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
This is a 6.4 re-run of the script we ran in dev, in order to avoid
conflicts between the branches when cherry-picking.
Change-Id: I5eca3df3179dfb2b2682c75a479ba9a4259cc703
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r-- | src/charts/barchart/abstractbarchartitem.cpp | 4 | ||||
-rw-r--r-- | src/charts/barchart/qbarset.cpp | 4 | ||||
-rw-r--r-- | src/charts/linechart/linechartitem.cpp | 2 | ||||
-rw-r--r-- | src/charts/splinechart/splinechartitem.cpp | 2 | ||||
-rw-r--r-- | src/charts/xychart/qxyseries.cpp | 4 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/charts/barchart/abstractbarchartitem.cpp b/src/charts/barchart/abstractbarchartitem.cpp index 23bce577..ab378a6e 100644 --- a/src/charts/barchart/abstractbarchartitem.cpp +++ b/src/charts/barchart/abstractbarchartitem.cpp @@ -181,7 +181,7 @@ void AbstractBarChartItem::handleLayoutChanged() void AbstractBarChartItem::handleLabelsVisibleChanged(bool visible) { bool newVisible = visible && m_series->isVisible(); - for (const QList<Bar *> &bars : qAsConst(m_barMap)) { + for (const QList<Bar *> &bars : std::as_const(m_barMap)) { for (Bar *bar : bars) { QGraphicsTextItem *label = bar->labelItem(); if (label) @@ -483,7 +483,7 @@ void AbstractBarChartItem::createLabelItems() m_labelItemsMissing = false; - for (const QList<Bar *> &bars : qAsConst(m_barMap)) { + for (const QList<Bar *> &bars : std::as_const(m_barMap)) { for (Bar *bar : bars) { QGraphicsTextItem *label = bar->labelItem(); if (!label) { diff --git a/src/charts/barchart/qbarset.cpp b/src/charts/barchart/qbarset.cpp index a213ca7b..562057cb 100644 --- a/src/charts/barchart/qbarset.cpp +++ b/src/charts/barchart/qbarset.cpp @@ -386,7 +386,7 @@ void QBarSet::insert(const int index, const qreal value) if (!d_ptr->m_selectedBars.isEmpty()) { // if value was inserted we need to move already selected bars by 1 QSet<int> selectedAfterInsert; - for (const auto &value : qAsConst(d_ptr->m_selectedBars)) { + for (const auto &value : std::as_const(d_ptr->m_selectedBars)) { if (value >= index) { selectedAfterInsert << value + 1; callSignal = true; @@ -895,7 +895,7 @@ int QBarSetPrivate::remove(const int index, const int count) if (!m_selectedBars.empty()) { QSet<int> selectedAfterRemoving; - for (const int &selectedBarIndex : qAsConst(m_selectedBars)) { + for (const int &selectedBarIndex : std::as_const(m_selectedBars)) { if (selectedBarIndex < index) { selectedAfterRemoving << selectedBarIndex; } else if (selectedBarIndex >= index + removeCount) { diff --git a/src/charts/linechart/linechartitem.cpp b/src/charts/linechart/linechartitem.cpp index cf5c8b89..764f01d2 100644 --- a/src/charts/linechart/linechartitem.cpp +++ b/src/charts/linechart/linechartitem.cpp @@ -304,7 +304,7 @@ void LineChartItem::updateGeometry() qreal markerHalfSize = (m_markerSize / 2.0) + 1; qreal markerSize = m_markerSize + 2; - for (const auto &point : qAsConst(m_linePoints)) { + for (const auto &point : std::as_const(m_linePoints)) { checkShapePath.addRect(point.x() - markerHalfSize, point.y() - markerHalfSize, markerSize, markerSize); diff --git a/src/charts/splinechart/splinechartitem.cpp b/src/charts/splinechart/splinechartitem.cpp index 0f1eb959..3114ade4 100644 --- a/src/charts/splinechart/splinechartitem.cpp +++ b/src/charts/splinechart/splinechartitem.cpp @@ -302,7 +302,7 @@ void SplineChartItem::updateGeometry() qreal markerHalfSize = (m_series->markerSize() / 2.0) + 1; qreal markerSize = m_series->markerSize() + 2; - for (const auto &point : qAsConst(points)) { + for (const auto &point : std::as_const(points)) { checkShapePath.addRect(point.x() - markerHalfSize, point.y() - markerHalfSize, markerSize, markerSize); diff --git a/src/charts/xychart/qxyseries.cpp b/src/charts/xychart/qxyseries.cpp index 309e199d..c3b51636 100644 --- a/src/charts/xychart/qxyseries.cpp +++ b/src/charts/xychart/qxyseries.cpp @@ -1218,7 +1218,7 @@ void QXYSeries::removePoints(int index, int count) if (!d->m_selectedPoints.empty()) { QSet<int> selectedAfterRemoving; - for (const int &selectedPointIndex : qAsConst(d->m_selectedPoints)) { + for (const int &selectedPointIndex : std::as_const(d->m_selectedPoints)) { if (selectedPointIndex < index) { selectedAfterRemoving << selectedPointIndex; } else if (selectedPointIndex >= index + count) { @@ -1255,7 +1255,7 @@ void QXYSeries::insert(int index, const QPointF &point) if (!d->m_selectedPoints.isEmpty()) { // if point was inserted we need to move already selected points by 1 QSet<int> selectedAfterInsert; - for (const auto &value : qAsConst(d->m_selectedPoints)) { + for (const auto &value : std::as_const(d->m_selectedPoints)) { if (value >= index) { selectedAfterInsert << value + 1; callSignal = true; |