Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl + Click and Drag to copy instance #2072

Open
wants to merge 19 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix alt click for nodes
7174Andy committed Dec 20, 2024
commit 69e9f5042e9bc5b09a6ecd073e132947410ab92d
7 changes: 3 additions & 4 deletions sleap/gui/widgets/video.py
Original file line number Diff line number Diff line change
@@ -2126,9 +2126,7 @@ def hoverLeaveEvent(self, event):
return super().hoverLeaveEvent(event)

def mousePressEvent(self, event):
"""Custom event handler for mouse press.

This method is called when the user clicks on the labeled instance."""
"""Custom event handler for mouse press."""
if event.buttons() == Qt.LeftButton:
if event.modifiers() == Qt.ControlModifier:
self._duplicate_instance()
@@ -2185,8 +2183,9 @@ def mouseMoveEvent(self, event):
"""Custom event handler to emit signal on event."""
is_move = self.flags() & QGraphicsItem.ItemIsMovable
is_ctrl_pressed = (event.modifiers() & Qt.ControlModifier) == Qt.ControlModifier
is_alt_pressed = (event.modifiers() & Qt.AltModifier) == Qt.AltModifier

if is_move and is_ctrl_pressed:
if is_move and (is_ctrl_pressed or is_alt_pressed):
super().mouseMoveEvent(event)

def mouseReleaseEvent(self, event):