I\'ve disabled X button in Qt from my dialog using this line:
myDialog->setWindowFlags(Qt::Dialog | Qt::Desktop)
Also you can handle the event in your dialog's class (at least if it's modal dlg):
void MyDialog::closeEvent(QCloseEvent* e) { if ( condition ) e->ignore(); else __super::closeEvent(e); }