I'm trying to use close() function to close my QMainWindow object which is the only window opened. But failed. It did triggered the QCloseEvent just like I pressed X button. I don't know why? Can anybody advise? Thanks