Skip to content

Locked nodes can start or cut connections, two lock states mix #536

Open

Description

@paceholder

Description with steps to reproduce

A node with the model flag NodeFlag::Locked can still start a connection or cut one.

NodeGraphicsObject::mousePressEvent only checks the lock of the group. It does not check the model lock.

  • Press the out port of a locked node: a draft connection is created.
  • Press an in port: interaction.disconnect can remove a connection of a locked node.

There is a second problem. The model lock and the group lock both write the item flags.

  • lock(false) makes the node selectable again, even if the model says it is locked. This happens in removeNodeFromGroup and in setGroupingEnabled(false).
  • nodeFlagsUpdated calls setLockedState(). A node in a locked group becomes selectable again.

Fix:

  • Return early on a press if the node has NodeFlag::Locked or its group is locked.
  • Set the item flags in one function. A node is selectable only if neither lock is set.

Tests to add:

  • A locked node does not start a draft connection and does not cut a connection.
  • A node stays unselectable while either lock is set.

Supporting files, videos and screenshots

No screenshots. I found it with tests that send simulated mouse events and with code reading.

Qt Version

Qt 6.12.0

Operating system

macOS 26.6

Additional context

Found while checking the node group commit 0d28130 (#514). The lock check on a port press was changed by that commit.

Checklist

  • I have verified that this issue has not been logged before, by searching the issue tracker for similar issues
  • I have attached all requested files and information to this report
  • I have attempted to identify the root problem as concisely as possible, and have used minimal reproducible examples where possible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions