fixed code to work on qt5.1