PDA

View Full Version : How to forbid close of one dialog and hide the cross



stella1016
5th April 2011, 16:46
In a dialog I have a progressbar, which indicates very important program update. This process cannot be interrupted. So I need to forbid the default ESCAPE button press action and hide the cross of the dialog.

What can I do to make this possible? Thanks.

Zlatomir
5th April 2011, 17:17
You can use a QWidget (as a "window" for your update) instead of a QDialog, since that doesn't close on "Esc" press.

And you can hide the close button by using a frame-less window flag:

window->setWindowFlags(Qt::FramelessWindowHint);

wysota
5th April 2011, 21:59
#include <QtGui>

int main(int argc, char **argv) {
QApplication app(argc, argv);

QDialog dlg;
dlg.setWindowFlags(Qt::Dialog|Qt::CustomizeWindowH int|Qt::WindowTitleHint);
return dlg.exec();
}

stella1016
6th April 2011, 08:51
Thanks!
That is exactly what I am looking for!

:)