Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Set ModernWindow to set the event state equal to the child state #24

Merged
merged 2 commits into from
Nov 11, 2019

Conversation

Jerakin
Copy link
Collaborator

@Jerakin Jerakin commented Aug 16, 2019

Purpose of change
If you click on the (x) button to close a window ModernWindow and the Child get different closeEvent's. This means that even of I .ignore() the event in the Child. The ModernWindow doesn't know this and closes anyway. (This can be observed by running the mainwindow.py and pressing the (x) button and taking "No" in the dialog - it closes anyway).

Describe the solution
Set the ModernWindow event to be accepted by the return value of the child's .close()

Potensial Problems
I am not sure what the need for the eventFilter as opposed to closeEvent, I changed ModernWindow to only use closeEvent for simplicity sake.

event.accept()
else:
self._w.close()
event.setAccepted(self._w.isHidden())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isHidden seems to be the most reliable way to figure out if a window is closed or not

@gmarull gmarull merged commit 3a4f092 into gmarull:master Nov 11, 2019
@Jerakin Jerakin deleted the closeEvent branch November 12, 2019 12:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants