Restore compatibility with GCC 11
std::ranges isn't working properly there yet, so replace that with a std::span-based approach. As we have one case working on a returned temporary, this needs means to extend the lifetime of the underlying QList.
Edited by Volker Krause