Fix Ctrl+C — use QShortcut instead of keyPressEvent

Grid widget was consuming the key event before it reached
the main window. QShortcut properly intercepts regardless
of which widget has focus.
This commit is contained in:
pax 2026-04-05 14:27:08 -05:00
parent 43a4e1e726
commit 84b49e4423

View File

@ -445,6 +445,7 @@ class BooruApp(QMainWindow):
# Global shortcuts for preview navigation # Global shortcuts for preview navigation
QShortcut(QKeySequence("Left"), self, lambda: self._navigate_preview(-1)) QShortcut(QKeySequence("Left"), self, lambda: self._navigate_preview(-1))
QShortcut(QKeySequence("Right"), self, lambda: self._navigate_preview(1)) QShortcut(QKeySequence("Right"), self, lambda: self._navigate_preview(1))
QShortcut(QKeySequence("Ctrl+C"), self, self._copy_preview_to_clipboard)
def _setup_menu(self) -> None: def _setup_menu(self) -> None:
menu = self.menuBar() menu = self.menuBar()
@ -1892,9 +1893,6 @@ class BooruApp(QMainWindow):
if self._preview._stack.currentIndex() == 1 and self._preview.underMouse(): if self._preview._stack.currentIndex() == 1 and self._preview.underMouse():
self._preview._video_player._toggle_play() self._preview._video_player._toggle_play()
return return
elif key == Qt.Key.Key_C and event.modifiers() == Qt.KeyboardModifier.ControlModifier:
self._copy_preview_to_clipboard()
return
super().keyPressEvent(event) super().keyPressEvent(event)
def _copy_preview_to_clipboard(self) -> None: def _copy_preview_to_clipboard(self) -> None: