refactor into QMainWindow