Known size, reserve.

This commit is contained in:
Albert Vaca 2016-11-26 16:19:00 +01:00
parent b7bb8d94c5
commit f41883f2f3
2 changed files with 5 additions and 2 deletions

View file

@ -306,6 +306,7 @@ bool Device::isTrusted() const
QStringList Device::availableLinks() const
{
QStringList sl;
sl.reserve(m_deviceLinks.size());
Q_FOREACH(DeviceLink* dl, m_deviceLinks) {
sl.append(dl->provider()->name());
}

View file

@ -109,8 +109,10 @@ void SendNotificationsConfig::save()
config()->set(QStringLiteral("generalUrgency"), m_ui->spin_urgency->value());
QVariantList list;
for (const auto& a: appModel->apps())
list << QVariant::fromValue<NotifyingApplication>(a);
list.reserve(appModel->apps().size());
for (const auto& a: appModel->apps()) {
list.append(QVariant::fromValue<NotifyingApplication>(a));
}
config()->setList(QStringLiteral("applications"), list);
KCModule::save();
Q_EMIT changed(false);