compatibility with qt 4.6 & 4.7, without interfering qt 4.8 and port to 5.X