Skip to content

Optionally add close shortcuts to dialogs#71

Merged
petebankhead merged 1 commit into
qupath:mainfrom
petebankhead:close-shortcuts
Apr 23, 2026
Merged

Optionally add close shortcuts to dialogs#71
petebankhead merged 1 commit into
qupath:mainfrom
petebankhead:close-shortcuts

Conversation

@petebankhead

Copy link
Copy Markdown
Member

Helps address qupath/qupath#2107

This changes FXUtils.addCloseWindowShortcuts(Stage) to become FXUtils.addCloseWindowShortcuts(Window) so that it's more general.

But it's still not general enough for a Dialog, since this isn't a subclass of Window either. So it adds FXUtils.addCloseDialogShortcuts(DialogPane) as well.

Dialog.Builder is then updated to have a closeShortcuts(boolean addShortcuts) method so that it's possible to specify that the shortcuts are or are not added.

The impact is mostly for Ctrl+W or Cmd+W, since Esc already seems to work.

If the shortcuts aren't specified, they are added by default for all dialogs that have no buttons, or that have a single button that is OK, Cancel or Close.

The behavior is to press the Cancel button is present, or fire a window close request otherwise.

@petebankhead petebankhead merged commit 96b90cf into qupath:main Apr 23, 2026
1 check passed
@petebankhead petebankhead deleted the close-shortcuts branch April 23, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant