1

Which SIGNAL is emitted, when pressing the "X" in the top right corner of a Qt Window application?

I have a second QDialog widget beside my MainWindow in my Qt application. And I would like to intercept the press on the "X" in my second QDialog, how?

Ilya
  • 4,583
  • 4
  • 26
  • 51
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103

2 Answers2

0

The QCloseEvent class contains parameters that describe a close event. Close events are sent to widgets that the user wants to close, usually by choosing "Close" from the window menu, or by clicking the X title bar button. They are also sent when you call QWidget::close() to close a widget programmatically.

To ignore it you can call ignore() method:

void YourDialog::closeEvent(QCloseEvent* iEvent)
{
  // ignore close event
  iEvent->ignore();
}
Ilya
  • 4,583
  • 4
  • 26
  • 51
0

There is no signal for that, you need to reimplement QWidget::closeEvent() or install an event filter filtering for QCloseEvents.

Frank Osterfeld
  • 24,815
  • 5
  • 58
  • 70