Fix Qt5 compile problems, clean up and remove compiler warnings