Various fixes

Only 8e51981 is critical, as it's a build fix required for systems that have Qt5 and Qt4 installed.