Fixes to Qt 5 port

As-is, the Qt 5 port just tried to load Qt 4 plugins, which segfalted. Qt 4 and Qt 5 cannot both be loaded into the same process.

This series fixes that, removes a bunch of hacks that are seemingly not needed, and some other misc small cleanup.