Commit 28e2ce2e authored by Laurent Montel's avatar Laurent Montel
Browse files

Use std::as_const

parent d4d8a5a2
Pipeline #142931 passed with stage
in 1 minute and 13 seconds
......@@ -220,7 +220,7 @@ QJsonArray SensorFaceControllerPrivate::readSensors(const KConfigGroup &read, co
QJsonArray newSensors;
for (auto entry : original) {
QString sensorId = entry.toString();
for (auto replacement : qAsConst(sensorIdReplacements)) {
for (auto replacement : std::as_const(sensorIdReplacements)) {
auto match = replacement.first.match(sensorId);
if (match.hasMatch()) {
sensorId.replace(replacement.first, replacement.second);
......
......@@ -104,7 +104,7 @@ CGroupDataModel::CGroupDataModel(const QString &root, QObject *parent)
attributes.append(new GroupNameAttribute(this));
attributes.append(new AppNameAttribute(this));
attributes.append(new AppIconAttribute(this));
for (auto attr : qAsConst(attributes)) {
for (auto attr : std::as_const(attributes)) {
d->m_availableAttributes[attr->id()] = attr;
}
......@@ -175,7 +175,7 @@ QStringList CGroupDataModel::enabledAttributes() const
{
QStringList rc;
rc.reserve(d->m_enabledAttributes.size());
for (auto attr : qAsConst(d->m_enabledAttributes)) {
for (auto attr : std::as_const(d->m_enabledAttributes)) {
rc << attr->id();
}
return rc;
......@@ -210,7 +210,7 @@ void CGroupDataModel::setEnabledAttributes(const QStringList &enabledAttributes)
});
}
for (auto unusedAttr : qAsConst(unusedAttributes)) {
for (auto unusedAttr : std::as_const(unusedAttributes)) {
disconnect(unusedAttr, &KSysGuard::ProcessAttribute::dataChanged, this, nullptr);
}
......@@ -405,7 +405,7 @@ void CGroupDataModel::update()
d->m_oldGroups = d->m_cgroupMap;
Processes::UpdateFlags flags;
for (auto attribute : qAsConst(d->m_enabledAttributes)) {
for (auto attribute : std::as_const(d->m_enabledAttributes)) {
flags |= attribute->requiredUpdateFlags();
}
......@@ -415,7 +415,7 @@ void CGroupDataModel::update()
update(d->m_rootGroup.data());
for (auto c : qAsConst(d->m_oldGroups)) {
for (auto c : std::as_const(d->m_oldGroups)) {
int row = d->m_cGroups.indexOf(c);
if (row >= 0) {
beginRemoveRows(QModelIndex(), row, row);
......
......@@ -523,7 +523,7 @@ ExtendedProcesses::ExtendedProcesses(QObject *parent)
});
connect(this, &KSysGuard::Processes::updated, this, [this]() {
for (auto p : qAsConst(d->m_providers)) {
for (auto p : std::as_const(d->m_providers)) {
if (p->enabled()) {
p->update();
}
......@@ -543,7 +543,7 @@ QVector<ProcessAttribute *> ExtendedProcesses::attributes() const
QVector<ProcessAttribute *> ExtendedProcesses::extendedAttributes() const
{
QVector<ProcessAttribute *> rc;
for (auto p : qAsConst(d->m_providers)) {
for (auto p : std::as_const(d->m_providers)) {
rc << p->attributes();
}
return rc;
......
......@@ -217,7 +217,7 @@ void ProcessDataModel::setEnabledAttributes(const QStringList &enabledAttributes
});
}
for (auto *unusedAttribute : qAsConst(unusedAttributes)) {
for (auto *unusedAttribute : std::as_const(unusedAttributes)) {
disconnect(unusedAttribute, &KSysGuard::ProcessAttribute::dataChanged, this, nullptr);
}
......@@ -367,7 +367,7 @@ void ProcessDataModel::Private::endMoveProcess()
void ProcessDataModel::Private::update()
{
Processes::UpdateFlags flags;
for (auto attribute : qAsConst(m_enabledAttributes)) {
for (auto attribute : std::as_const(m_enabledAttributes)) {
flags |= attribute->requiredUpdateFlags();
}
......
......@@ -31,7 +31,7 @@ struct Q_DECL_HIDDEN SensorTreeItem {
inline int indexOf(const QString &segment)
{
int index = 0;
for (auto child : qAsConst(children)) {
for (auto child : std::as_const(children)) {
if (child->segment == segment) {
return index;
}
......@@ -44,7 +44,7 @@ struct Q_DECL_HIDDEN SensorTreeItem {
inline SensorTreeItem *itemAt(int index)
{
int currentIndex = 0;
for (auto child : qAsConst(children)) {
for (auto child : std::as_const(children)) {
if (currentIndex++ == index) {
return child;
}
......
......@@ -126,7 +126,7 @@ void AggregateSensor::subscribe()
bool wasSubscribed = SensorProperty::isSubscribed();
SensorProperty::subscribe();
if (!wasSubscribed && isSubscribed()) {
for (auto sensor : qAsConst(d->sensors)) {
for (auto sensor : std::as_const(d->sensors)) {
if (sensor) {
sensor->subscribe();
}
......@@ -139,7 +139,7 @@ void AggregateSensor::unsubscribe()
bool wasSubscribed = SensorProperty::isSubscribed();
SensorProperty::unsubscribe();
if (wasSubscribed && !isSubscribed()) {
for (auto sensor : qAsConst(d->sensors)) {
for (auto sensor : std::as_const(d->sensors)) {
if (sensor) {
sensor->unsubscribe();
}
......
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