Port code to QT5.