Use range-based for to iterate over a QRegion
According to
https://doc.qt.io/qt-5/qregion-obsolete.html#rects
the method QRegion::rects is obsolete and should be avoided.
Let's do that by moving to a range-based for over the QRegion.
That is easier to read anyway.