Skip to content

Commit

Permalink
Hide right click copy option in deck list (ankitects#3363)
Browse files Browse the repository at this point in the history
* hide copy if nothing selected

* Update CONTRIBUTORS

* type hint

* Update CONTRIBUTORS
  • Loading branch information
bpnguyen107 authored and jeankhawand committed Aug 17, 2024
1 parent 880ea7c commit 6dd39bf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions qt/aqt/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,15 @@ def onSelectAll(self) -> None:

def contextMenuEvent(self, evt: QContextMenuEvent) -> None:
m = QMenu(self)
a = m.addAction(tr.actions_copy())
qconnect(a.triggered, self.onCopy)
self._maybe_add_copy_action(m)
gui_hooks.webview_will_show_context_menu(self, m)
m.popup(QCursor.pos())

def _maybe_add_copy_action(self, menu: QMenu) -> None:
if self.hasSelection():
a = menu.addAction(tr.actions_copy())
qconnect(a.triggered, self.onCopy)

def dropEvent(self, evt: QDropEvent) -> None:
if self.allow_drops:
super().dropEvent(evt)
Expand Down

0 comments on commit 6dd39bf

Please sign in to comment.