You could try calling mainWindow->showMinimized();

If that doesnt work, you can try this -
Set the opacity of the main window to 0. The window would be there, not visible. But how you choose to make it opaque again might be tricky