Integrate the latest changes from upstream, branch 5.4

This is a rebase of mer-stable on top of upstream/5.4, with b743fc7a1e6ee680ca89ae17fb6b521178fd09a9 reverted because qtbase 5.2 doesn't have the RasterGLSurface type.