Addressbook example: port to QLatin1StringView

This allows to fix the warning:
 qtbase/examples/widgets/itemviews/addressbook/addresswidget.cpp:115:
  warning: loop variable ‘str’ of type ‘const QString&’ binds to a
  temporary constructed from type ‘const char* const’
  [-Wrange-loop-construct]

Pick-to: 6.4
Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This commit is contained in:
Ivan Solovev 2022-07-14 12:08:16 +02:00
parent e6c7d049f4
commit 7d2361b9da

View File

@ -110,10 +110,12 @@ void AddressWidget::removeEntry()
//! [1]
void AddressWidget::setupTabs()
{
const auto groups = { "ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VW", "XYZ" };
using namespace Qt::StringLiterals;
const auto groups = { "ABC"_L1, "DEF"_L1, "GHI"_L1, "JKL"_L1, "MNO"_L1, "PQR"_L1,
"STU"_L1, "VW"_L1, "XYZ"_L1 };
for (const QString &str : groups) {
const auto regExp = QRegularExpression(QString("^[%1].*").arg(str),
for (QLatin1StringView str : groups) {
const auto regExp = QRegularExpression(QLatin1StringView("^[%1].*").arg(str),
QRegularExpression::CaseInsensitiveOption);
auto proxyModel = new QSortFilterProxyModel(this);