Is it possible to remove the close button (see screenshot) of a QProgressDialog
? I couldn't find anything useful in the docs/Google.
I use a modal QProgressDialog
to show infinite process and block the GUI until a lengthy operation has completed. Because the GUI should be blocked, I don't want the user to be able to close the dialog.
You can hide close button of every window by clearing an appropriate flag:
QProgressDialog dlg;
dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowCloseButtonHint);
Qt::WindowCloseButtonHint 0x08000000 Adds a close button. On some platforms this implies Qt::WindowSystemMenuHint for it to work.
QProgressDialog dlg;
dlg.setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
where
Qt::Window
stands for windowQt::WindowTitleHint
stands for displaying title on the top of the windowQt::CustomizeWindowHint
stands for not displaying buttonsIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With