Updated code to run with QT5