summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-07-14 12:08:16 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-07-15 14:44:38 +0200
commit7d2361b9da5c1ee9ef0724917108d6a3294e14c2 (patch)
treed45da1967a0a79d7f8dce8fccee981623aa2ba61 /examples/widgets/itemviews
parente6c7d049f4c737c8d98b0abf5d20e6ebeec1d646 (diff)
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>
Diffstat (limited to 'examples/widgets/itemviews')
-rw-r--r--examples/widgets/itemviews/addressbook/addresswidget.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/widgets/itemviews/addressbook/addresswidget.cpp b/examples/widgets/itemviews/addressbook/addresswidget.cpp
index de6b57e9d7..955a766750 100644
--- a/examples/widgets/itemviews/addressbook/addresswidget.cpp
+++ b/examples/widgets/itemviews/addressbook/addresswidget.cpp
@@ -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);