Quit the Project Manager when Command + Q is pressed

This uses the same shortcut as quitting Godot while in the editor.

This partially addresses #27251.
This commit is contained in:
Hugo Locurcio 2019-03-20 00:47:34 +01:00
parent 86a74e2cb3
commit deb7152724
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
1 changed files with 13 additions and 0 deletions

View File

@ -2166,6 +2166,19 @@ ProjectManager::ProjectManager() {
Button *cancel = memnew(Button);
cancel->set_text(TTR("Exit"));
cancel->set_custom_minimum_size(Size2(100, 1) * EDSCALE);
#ifndef OSX_ENABLED
// Pressing Command + Q quits the Project Manager
// This is handled by the platform implementation on macOS,
// so only define the shortcut on other platforms
InputEventKey *quit_key = memnew(InputEventKey);
quit_key->set_command(true);
quit_key->set_scancode(KEY_Q);
ShortCut *quit_shortcut = memnew(ShortCut);
quit_shortcut->set_shortcut(quit_key);
cancel->set_shortcut(quit_shortcut);
#endif
cc->add_child(cancel);
cancel->connect("pressed", this, "_exit_dialog");
vb->add_child(cc);