Add some code into keyPressEvent of MainWindow.