Skip to content

Switch to the Select tool when Escape is pressed in a view#1023

Open
roor0 wants to merge 1 commit into
leozide:masterfrom
roor0:claude/zen-bell-1467fc
Open

Switch to the Select tool when Escape is pressed in a view#1023
roor0 wants to merge 1 commit into
leozide:masterfrom
roor0:claude/zen-bell-1467fc

Conversation

@roor0

@roor0 roor0 commented Jun 10, 2026

Copy link
Copy Markdown

What

Pressing Esc while a model view has focus now switches back to the default Select tool. This gives a quick keyboard way to exit the Insert, Eraser, or other active tools without reaching for the toolbar.

Why

Esc to return to the default/neutral state is a near-universal convention in editing tools, and there is currently no keyboard way to leave a tool such as Insert or Eraser once it is active.

Why not just an assignable shortcut?

I first tried doing this purely through the existing Preferences keyboard-shortcut system (binding Esc to Edit.Tool.Select), since the project generally prefers user-assignable shortcuts. That did not work: when the OpenGL view (lcViewWidget) has focus it receives the key event first, so the QAction shortcut (default WindowShortcut context) never fires for keys pressed over the 3D view.

Handling Esc directly in lcViewWidget::keyPressEvent is the reliable fix, and a fixed Escape binding is consistent with the universal "escape returns to the default state" convention.

Implementation

  • Handles Qt::Key_Escape in lcViewWidget::keyPressEvent and calls gMainWindow->SetTool(lcTool::Select).
  • Limited to the main model view (lcViewType::View) so it does not affect preview widgets.
  • Null-checks gMainWindow, accepts the event, and falls through to the default handler for every other key, leaving existing Ctrl/Shift handling untouched.
  • Intentionally scoped to only switching tools: it does not clear the selection or cancel in-progress tracking, to keep the behavior predictable and the change minimal.

Pressing Escape in a model view now returns to the default Select
tool, providing a quick way to exit the Insert, Eraser, or other
active tools from the keyboard.
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