Verified Commit 4c1aa258 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Fix some Qt container anti pattern

parent c3328db8
......@@ -309,8 +309,10 @@ QStringList DocumentHandler::defaultFontSizes() const
{
// uhm... this is quite ugly
QStringList sizes;
QFontDatabase db;
for (int size : db.standardSizes())
const QList<int> standardSizes = QFontDatabase::standardSizes();
sizes.reserve(standardSizes.count());
for (int size : standardSizes) {
sizes.append(QString::number(size));
}
return sizes;
}
......@@ -755,8 +755,8 @@ void ComicProviderWrapper::requestPage(const QString &url, int id, const QVarian
{
QMap<QString, QString> map;
for (const QString &key : infos.keys()) {
map[key] = infos[key].toString();
for (auto it = infos.begin(), end = infos.end(); it != end; ++it) {
map[it.key()] = it.value().toString();
}
mProvider->requestPage(QUrl(url), id, map);
++mRequests;
......@@ -766,8 +766,8 @@ void ComicProviderWrapper::requestRedirectedUrl(const QString &url, int id, cons
{
QMap<QString, QString> map;
for (const QString &key : infos.keys()) {
map[key] = infos[key].toString();
for (auto it = infos.begin(), end = infos.end(); it != end; ++it) {
map[it.key()] = it.value().toString();
}
mProvider->requestRedirectedUrl(QUrl(url), id, map);
++mRequests;
......
......@@ -78,8 +78,7 @@ void DictionaryMatchEngine::dataUpdated(const QString &source, const Plasma::Dat
QString definition(result[QLatin1String("text")].toString());
m_wordLock.lockForRead();
const auto values = m_lockers.values(source);
for (ThreadData *data : values) {
for (ThreadData *data : qAsConst(m_lockers)) {
QMutexLocker locker(&data->mutex);
/* Because of QString's CoW semantics, we don't have to worry about
* the overhead of assigning this to every item. */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment