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>
This commit is contained in:
parent
7562089f4e
commit
672b8dc4f5
@ -110,10 +110,12 @@ void AddressWidget::removeEntry()
|
|||||||
//! [1]
|
//! [1]
|
||||||
void AddressWidget::setupTabs()
|
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) {
|
for (QLatin1StringView str : groups) {
|
||||||
const auto regExp = QRegularExpression(QString("^[%1].*").arg(str),
|
const auto regExp = QRegularExpression(QLatin1StringView("^[%1].*").arg(str),
|
||||||
QRegularExpression::CaseInsensitiveOption);
|
QRegularExpression::CaseInsensitiveOption);
|
||||||
|
|
||||||
auto proxyModel = new QSortFilterProxyModel(this);
|
auto proxyModel = new QSortFilterProxyModel(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user