diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 09:03:30 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 12:38:17 +0000 |
commit | 8e541a22b513432ed566fca824af207395ee0c90 (patch) | |
tree | 9243cea5077075858282a4edd2b2b2ed365b8c9b | |
parent | e23faffcfd66d96534834f6befcdebdeae7c56f4 (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.
While this project maintains compatibility with Qt 5.15, it requires
C++17 at the same time, so we don't need to add version checks.
Task-number: QTBUG-99313
Change-Id: I7ba355e636ba1bfac94b787240a9bef2f3bb4e0b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r-- | src/qlitehtmlwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qlitehtmlwidget.cpp b/src/qlitehtmlwidget.cpp index 965aaf5..3449fe5 100644 --- a/src/qlitehtmlwidget.cpp +++ b/src/qlitehtmlwidget.cpp @@ -449,7 +449,7 @@ bool QLiteHtmlWidget::findText(const QString &text, .findText(text, flags, incremental, wrapped, &success, &oldSelection, &newSelection); // scroll to search result position and/or redraw as necessary QRect newSelectionCombined; - for (const QRect &r : qAsConst(newSelection)) + for (const QRect &r : std::as_const(newSelection)) newSelectionCombined = newSelectionCombined.united(r); QScrollBar *vBar = verticalScrollBar(); const int top = newSelectionCombined.top(); @@ -460,7 +460,7 @@ bool QLiteHtmlWidget::findText(const QString &text, vBar->setValue(bottom); } else { viewport()->update(fromVirtual(newSelectionCombined.translated(-scrollPosition()))); - for (const QRect &r : qAsConst(oldSelection)) + for (const QRect &r : std::as_const(oldSelection)) viewport()->update(fromVirtual(r.translated(-scrollPosition()))); } return success; |