ported to qt5 and fixed #1