Using Qt Creator to edit C++11 code for the MinGW build kit.
Each time we iterate over a Qt container it gives this warning:
Is there a better way to write this which doesn't trigger the warning?
Using C++11 range-based for loop correctly in Qt is not an answer - please don't mark as duplicate! This question suggests to use qAsConst; however this doesn't seem to help:
for (const QString &field : qAsConst(fields.keys()))
// - "Call to deleted function qAsConst"
for (const QString &field : qAsConst(fields).keys())
// - no effect, obviously - it was already const
for (const QString &field : std::as_const(fields.keys()))
// - "Call to deleted function as_const"
for (QJsonObject::const_iterator field = fields.constBegin(); field != fields.constEnd(); ++field)
// works, but a bit long-winded