Updated code to compile on Qt5