Replace for loops with range-based for loop where possible for clarity
Many for loops can be made clearer by using range-based for loops, available since C++11.
Some relevant webpages:
- https://www.kdab.com/qt-range-based-for-loops-and-structured-bindings/
- https://www.kdab.com/goodbye-q_foreach/
- https://stackoverflow.com/questions/35811053/using-c11-range-based-for-loop-correctly-in-qt
- https://www.dvratil.cz/2015/06/qt-containers-and-c11-range-based-loops/
- https://doc.qt.io/qt-6/qtglobal.html#qAsConst
- https://embeddeduse.com/2016/05/13/simplifying-loops-with-cpp11/