paceholder / nodeeditor

Qt Node Editor. Dataflow programming framework
BSD 3-Clause "New" or "Revised" License
2.94k stars 796 forks source link

Allow updating node data model after the node being created #326

Closed bgao closed 1 year ago

bgao commented 1 year ago

The size and connections will be recalculated after the node data model update

paceholder commented 1 year ago

Could you please describe your issue in a couple of words?

Thanks

bgao commented 1 year ago

Could you please describe your issue in a couple of words?

Thanks

Sure.

The old behavior: Once the Node is created, if the underlying NodeModel is changed, which may change the inputs/outputs of the node, the geometry size and number of connectors of the node in the editor won't change to reflect the NodeModel change.

With the proposed changes: If the NodeModel is changed, user can call updateNodeState() from Node and the geometry size and corresponding connectors will be updated to reflect the NodeModel change.

paceholder commented 1 year ago

Please look at the implementation of NodeDelegateModel. There are several signals:

Alternatively, if you are not going to use the data propagation and aim an the simple graph visualization, you could derive your graph model from AbstractGraphModel and emit the same signals from this class.

See the example "dynamic_ports".

Would it solve your problem?