Modified for qt5