Porting code to Qt5