Use event filter

create a event filter to resize main window, reduce the code in
CMainWindow.