Various code fixes for building against Qt6
This is far from complete, but this should be the non-controversial part as it doesn't touch the build system or add version ifdefs.
This is far from complete, but this should be the non-controversial part as it doesn't touch the build system or add version ifdefs.