You are a good guesser, Sean!

I tried commenting out the call I make to:

    setAttribute(Qt::WA_DeleteOnClose);

when I’m setting up my main windows.  With that commented out, things work 
fine.  I’m leaking the document window and everything it owns, of course, so 
that isn’t great; but it works.  So perhaps I can make a minimal document 
window at startup, which I never show, just to make Qt happy.

The other quirk I’ve just noticed is that even *without* commenting out that 
call, there is a usage pattern where everything works, and a different usage 
pattern where it doesn’t.  In my testing, I had been following the pattern that 
doesn’t work.  In summary:

WORKS: pressing command-W to trigger my Close menu item, which just calls 
close() on the active window; my guess is that something about the processing 
of the shortcut, or a different order of operations internally, makes this 
usage pattern work properly.  The Quit menu item, etc., appear after the window 
is closed.

DOESN’T WORK: closing the active window by clicking its title bar close button 
instead.  The Quit menu item, etc., just vanish.

If there were something about the usage pattern that works that I could trigger 
in the case of the usage pattern that doesn’t work, perhaps that would 
constitute a workaround.  However, Sean’s idea presently appears that it will 
provide a workaround too, so I’ll try that first.

Thanks Sean!

Cheers,
-B.

Benjamin C. Haller
Messer Lab
Cornell University


> On Sep 22, 2020, at 2:56 PM, Murphy, Sean <smur...@walbro.com> wrote:
> 
> I'm not on a Mac right now, so I can't try this, so I don’t know if this will 
> work:
> 
> As each window (I assume these are QMainWindow, or at least inherit from 
> one) is closed, are you deleting them? If so, when you get to the last one, 
> could 
> you hide it instead of deleting it? Or when you've deleted the last one, then 
> immediately create a new one and hide it?
> 
> My theory being that maybe for Qt to do it's Mac menu magic, there needs 
> to always be a QMainWindow present (but not necessarily shown)?
> 
> Just a total guess on my part...
> Sean
> 
> 
> This message has been scanned for malware by Forcepoint. www.forcepoint.com

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to