Qt 5 support and build fixes