Various fixes to properly support compilation against Qt5