diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-06 11:14:17 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 17:18:49 +0200 |
commit | 66cd83d68007c91d67ffdcb0a203b5f22b2d5a50 (patch) | |
tree | a4bf606fc4827121ae4da87952a78493258a9385 | |
parent | 569dce897310a0a24e1fc0d4744a26b812de94e4 (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.
Task-number: QTBUG-99313
Change-Id: Iae5ffa3c7a961e8542f2d8df4a5b09dfeaffb8b2
Reviewed-by: Ivan Solovev <ivan.solovev@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 1335fd47..a1fbd9dc 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 8e029a2e..5e886e54 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 4498d91b..018bf011 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 1dbef8c2..d1ee6b10 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; |