tallforasmurf / CHIP8IDE

An interactive development and emulation environment for the CHIP8/SCHIP system
30 stars 1 forks source link

Windows windows don't all close #26

Closed tallforasmurf closed 7 years ago

tallforasmurf commented 7 years ago

Each of the 3 windows on Windows 7 has an [X] box, but only the one on the Edit window will terminate the app. The others just close that window (Display or Memory).

And there's no way to get them back except to terminate and restart the app.

Possible: either intercept closeEvent() in those widgets and refuse to close. Or, supply a View menu with some command to display windows? But that would be a lot of work and anyway the window status/contents would be lost. Just don't let them close independently.

tallforasmurf commented 7 years ago

The problem is, you don't want a window to just always ignore closeEvent calls. For one thing we are using closeEvent() to save geometry etc in the settings. Well, could still do that, but then set event.ignore() and return. Would that work, or would those windows never close? (And would it be different on different platforms?)

Is there a way to distinguish between a closeEvent that means, "red x on windows clicked" versus one that means "the app is shutting down"?

tallforasmurf commented 7 years ago

Further investigation. Affects MacOS also, of course: click the red button and that window disappears and you can't get it back.

Also, using event.ignore() on a closeEvent makes it IMPOSSIBLE to close a window, even after Quit is issued. I did that in the Display window and even after a quit, that window hung around looking at me until I force-quit the app.

Also, the QCoreApplication.aboutToQuit signal comes AFTER the closeEvent is delivered, so that can't be used to condition the handling of the event.

However. The Source window has the menu and it gets the Quit triggered signal, which right now is just connected to self.close(). However, we could do something with it, e.g. set a global? send a signal? that the other windows could use as a condition of accepting or ignoring the closeEvent.

tallforasmurf commented 7 years ago

Specifically, added a quit_signal_slot to each of memory and display modules, where noted the fact we are ACTUALLY_QUITTING, and ignored the closeEvent unless that was true.