Skip to content

Fix Ctrl+S shortcut handling in media viewer - #31509

Open
mymindinsane wants to merge 2 commits into
telegramdesktop:devfrom
mymindinsane:fix/media-viewer-ctrl-s
Open

mymindinsane wants to merge 2 commits into
telegramdesktop:devfrom
mymindinsane:fix/media-viewer-ctrl-s

Conversation

@mymindinsane

Copy link
Copy Markdown

Fixes #31437

Possible cause

Ctrl+S is also registered as the StashMessage command in core/shortcuts.cpp, using Qt::ApplicationShortcut.

When the media viewer receives a QEvent::ShortcutOverride for Ctrl+S, the event filter returns true without explicitly accepting the event. This may allow the application-wide shortcut to take priority, preventing the media viewer from receiving the normal key press.

Fix

Call event->accept() when handling QKeySequence::Save or QKeySequence::SaveAs in OverlayWidget::filterApplicationEvent().

As described in the Qt documentation, a QEvent::ShortcutOverride must be explicitly accepted for the override to take effect.

Testing

Tested on Windows 11 with Qt 6:

  • Ctrl+S opens the Save As dialog in the media viewer.
  • Ctrl+Shift+S continues to work.
  • Ctrl+S still performs the existing draft action in the chat editor.

The video below compares the original behavior with the fix:

  • Left: Telegram Desktop 7.3.3 (dark theme, without the fix).
  • Right: Locally built Telegram Desktop with the fix applied (light theme).
2026-10-23.22-27-34.mp4

This branch has not been deployed

No deployments
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.

Ctrl+S does not save photos after Telegram Desktop update

1 participant