Skip to content

Read the node id in the example models as an unsigned number - #570

Merged
paceholder merged 1 commit into
masterfrom
fix-simple-model-load-id
Nov 29, 2026
Merged

paceholder merged 1 commit into
masterfrom
fix-simple-model-load-id

Conversation

@paceholder

@paceholder paceholder commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring

Description

The example models read the node id with QJsonValue::toInt(). It returns 0 for ids above 2147483647, so a saved id such as 3000000000 was loaded as node 0. The examples now use jsonValueToUInt32(), as DataFlowGraphModel::loadNode() does. This fixes simple_graph_model, custom_painter, vertical_layout and dynamic_ports.

An invalid id (missing or not a number) gives InvalidNodeId. The examples do not check it, same as DataFlowGraphModel::loadNode().

There is no new test. The examples are demos and the tests are for the library. The library path is covered by the test for ids above the int range in the scene load and group restore.

Testing

  • Qt version tested: 6. The examples were built with -DBUILD_EXAMPLES=ON. CI covers Qt5.
  • Existing tests still pass
  • Added tests for new functionality (not applicable, see above)

Not tested: none of the four examples was run with a saved id above 2147483647.

Breaking changes?

No.

Related issue

None.

QJsonValue::toInt() returns 0 for ids above 2147483647. Use jsonValueToUInt32() as the library does.
@paceholder
paceholder force-pushed the fix-simple-model-load-id branch from b20ab85 to e4089c2 Compare November 29, 2026 20:22
@paceholder
paceholder merged commit 8050c26 into master Nov 29, 2026
5 checks passed
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.

1 participant