Disable the close button of a QMessageBox
Unsolved
General and Desktop
-
Hi,
How can i disable or remove the close button of a QMessageBox ?
I need the user to click the only button in the messagebox.I have tried this :
msgBox.setWindowFlags(msgBox.windowFlags() & ~Qt::WindowCloseButtonHint)but it's not working
thx for help :)
-
I tried this and it seems to work for me (I'm using Windows):
msgBox.setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
The Qt::CustomizeWindowHint flag turns off the default window title hints (in my case, I had only the close button by default), but it also removed the title bar, which is why I needed the second flag (Qt::WindowTitleHint).
Works for you as well?