Modeless QDialog hideEvent doesnt get called when clicked outside
-
Hi,
I have a modeless dialog and I want to so some stuff when user clicks outside the dialog and the dialog is hidden. I try to overwrite QDialog's hideEvent() but strangely it never gets called.
Do I need to set some property over the dialog?
Regards,
Smita -
Hi,
Something's not clear in your description e.g. how is your dialog hidden when the user clicks outside of it ?
Also, what version of Qt and OS are you running ?
-
To be clear, I set setWindowModality(Qt::NonModal) on my QDialog which makes the dialog to hide, as it doesnt block user input. Doc says: "The window is not modal and does not block input to other windows."
By setting this on my dialog, if I just click somewhere outside, the dialog automatically hides. I am trying to do something on this hideEvent. May be I am wrong and some other event is happening rather than hide().
I am using Qt 5 with Linux
-
Can you show the code of your hideEvent ?
-
Well not much I am doing the hideEvent. I am just printing something so that I know hideEvent is called.
void Info_Dialog::hideEvent(QHideEvent * e) {
qDebug()<<"hide event called";
} -
You can also try looking for QHideEvent in the event(QEvent * event) function