Skip to content

Tighten API naming, close NodeRole enum gap, protect newNodeId#3

Open
imakris wants to merge 1 commit intomasterfrom
claude/review-repo-thoroughly-wHRtF
Open

Tighten API naming, close NodeRole enum gap, protect newNodeId#3
imakris wants to merge 1 commit intomasterfrom
claude/review-repo-thoroughly-wHRtF

Conversation

@imakris
Copy link
Copy Markdown
Owner

@imakris imakris commented Mar 25, 2026

Summary

Addresses the last 3 remaining API issues from the thorough code review, plus a docs formatting bug:

  • Rename getNodeId/getPortIndexconnectionNodeId/connectionPortIndex — the old names read as "get a node's ID" when they actually extract a field from a ConnectionId for a given port side. The new names make the intent clear.
  • Close NodeRole enum gapOutPortCount was 9 (skipping 8), causing all subsequent values to be non-sequential. Renumbered to OutPortCount=8, Widget=9, ValidationState=10, ProcessingStatus=11.
  • Move newNodeId() from public to protected on AbstractGraphModel — this is a side-effectful ID generator that only subclasses and internal library code should call. External code should use addNode() instead. Internal callers (BasicGraphicsScene, PasteCommand) are added as friends.
  • Fix docs table formatting in graph-models.rst — a .. note:: block was inserted mid-table, breaking the Caption and CaptionVisible rows. Moved the note after the complete table.

Test plan

  • Verify library compiles with Qt5 and Qt6
  • Run existing test suite (TestConnectionId, TestAbstractGraphModel, TestDataFlow, etc.)
  • Verify examples build and run (enum renumbering is source-compatible since values are used symbolically, not as magic numbers)
  • Check docs render correctly with the table fix

https://claude.ai/code/session_01BSbxaZ4ghZbro1BibMXJBY

- Rename getNodeId/getPortIndex to connectionNodeId/connectionPortIndex
  to clarify these extract fields from a ConnectionId, not from a node.
- Close the NodeRole enum gap (7→9) by renumbering OutPortCount=8,
  Widget=9, ValidationState=10, ProcessingStatus=11.
- Move newNodeId() from public to protected on AbstractGraphModel;
  only subclasses and internal library friends need to mint node IDs.
- Fix docs table formatting: move note block after the complete table
  so Caption/CaptionVisible rows render correctly.

https://claude.ai/code/session_01BSbxaZ4ghZbro1BibMXJBY
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