Adapted MainWindow.cpp to Qt5