summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-07-14 12:08:16 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-07-15 22:17:24 +0000
commit672b8dc4f53a565f067bfecc56b0724478f7851e (patch)
treeb9d27e0966b1bc7913182024b0befc73df95f350 /examples/widgets
parent7562089f4ef6330c6dececbbb19a127cabfe8ea3 (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] Change-Id: Ibbfa7f9e85fe9ef79291f9da3d161667286b282e Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 7d2361b9da5c1ee9ef0724917108d6a3294e14c2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/widgets')
-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);