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

Edit label on double click on shape in canvas #1361

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

michaelitvin
Copy link

No description provided.

@maplelost
Copy link

maplelost commented Sep 27, 2024

Great! but you dont't need to add an extra signal to watch the mouseDoubleClick, you can simply add your code above, and it work

    def mouseDoubleClickEvent(self, ev):
        # extra 双击 shape 编辑其名称
        if ev.button() == QtCore.Qt.LeftButton and self.editing() and len(self.selectedShapes or []) == 1:
            STORE.edit_label()
            self.selectShapes([]) # prevent click but cancel, next time not trigger edit
            return
        # extra End

        if self.double_click != "close":
            return

        if (
                self.createMode == "polygon" and self.canCloseShape()
        ) or self.createMode in ["ai_polygon", "ai_mask"]:
            self.finalise()

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.

2 participants