QDialogs receive NO close-event in case of closing via the ESC-key. Nice.

Written by  on February 7, 2020 

At first this looked like a bug, but upon reading carefully the documentation and crawling the internet, I’ve noticed that this is
a) wanted behavior and b) I am not the first one stumbling over this issue.

So just override in the header the method for processing the QHideEvent:

And reimplement the base-class-call with the emission of a custom signal (or triggering custom functionality) for futher processing. Like:

Edit:
Another way is to connect the QDialog’s finished-signal to your signal via DirectConnection. Less code than overriding.

Category : C++Qt