Port away from most cases of Q_FOREACH to C++11 ranged for loop.

In order to avoid deep copies, Qt containers over which we iterate must be const
The remaining unported cases require qAsConst (Qt 5.7) or std::as_const (C++17)
This commit is contained in:
Andrius Štikonas 2016-09-01 13:21:05 +01:00
parent b0122f25e5
commit 9f0ca042fe
35 changed files with 105 additions and 92 deletions

View file

@ -44,7 +44,7 @@ Branding::instance()
}
QStringList Branding::s_stringEntryStrings =
const QStringList Branding::s_stringEntryStrings =
{
"productName",
"version",
@ -60,14 +60,14 @@ QStringList Branding::s_stringEntryStrings =
};
QStringList Branding::s_imageEntryStrings =
const QStringList Branding::s_imageEntryStrings =
{
"productLogo",
"productIcon",
"productWelcome"
};
QStringList Branding::s_styleEntryStrings =
const QStringList Branding::s_styleEntryStrings =
{
"sidebarBackground",
"sidebarText",
@ -268,7 +268,7 @@ void
Branding::setGlobals( GlobalStorage* globalStorage ) const
{
QVariantMap brandingMap;
foreach ( const QString& key, s_stringEntryStrings )
for ( const QString& key : s_stringEntryStrings )
brandingMap.insert( key, m_strings.value( key ) );
globalStorage->insert( "branding", brandingMap );
}