Recently, I wrote a background program. The main window has been hidden and qmessagebox will pop up under specific circumstances. If you click the OK button in the pop-up window at this time, the whole program will exit.
The final solution: add a sentence to the main function QApplication::setQuitOnLastWindowClosed(false);