-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Close only “child” window (e.g. Preview) inside Browser on Cmd+W #3913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Close only “child” window (e.g. Preview) inside Browser on Cmd+W #3913
Conversation
5c7d372
to
9812a71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an improvement, though there's still an issue not caused by this PR: if the user switches to the main window then back to preview, the shortcut stops working, as the main window's menu is still active.
Given #3905 as well, it's got me wondering whether we'd be better off with a global shortcut handler that does something like what you've done here, so we don't need to manually add the shortcuts to each different dialog. WDYT?
Yeah, it is an interesting issue with switching windows. I wonder, does Qt actually offer some pattern on how to manage those handlers. As a side note, I tried “simply closing the Browse window if it’s active and do nothing otherwise (hoping that a sub-dialog has its own handler)” approach, and that does not work. Even if I install the handler to a sub-window, it apparently gets intercepted by the Browse window. 🙈 The global approach obviously sounds better! I suppose, I’ll try to at least research into that direction. But I am not sure that I won’t miss some important aspects of Anki’s architecture or Qt’s approaches. |
It's a learning experience for all of us :-) |
9812a71
to
f275385
Compare
I noticed you updated this - does that mean you'd prefer to merge this in as-is for now? |
f275385
to
c71a053
Compare
@dae, yes, I think I’d prefer that.
|
Actually #3885 could affect how close actions work. 🤔 |
Currently, if a user tries to close Preview which was opened inside Browse, the "parent" Browse window itself gets closed
c71a053
to
6c63196
Compare
Not all of our windows have access to a menubar, and I don't think we'll be moving to a unified bar in the near future, so a global shortcut is more useful. |
Currently if we open Preview (for example) while being in the Browse mode, and then we try to close the Preview by pressing
Cmd+W
, both the Preview and the “parent” Browse window get closed. This feels counter-intuitive asCmd+W
should only close the “current window”.Before
Before.mov
After
After.mov
It is interesting that Qt does not do ”the right thing” out of the box. 📦