You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NodeDataModel::setNodeStyle() is of no effect #377
I have found that the node style for a special node is of no use. After checking the implement of DataFlowGraphModel::nodeData, I think these code maybe not right:
case NodeRole::Style: {
auto style = StyleCollection::nodeStyle();
result = style.toJson().toVariantMap();
Here a global node style is returned, so the specialed style for a node does not work.
I guess here should be:
auto style = model->nodeStyle();
Or there are any reasons to return a global style?
This question is old. We answer it for readers and search systems that find this thread later.
This works now. Since 3.1.5, NodeRole::Style returns the style of the node's own NodeDelegateModel, so setNodeStyle() sets the style of one node. setNodeStyle() does not repaint by itself. Call it before the node is shown, or emit requestNodeUpdate() afterwards. A test for this is in PR #550.
Changing the global style with StyleCollection::setNodeStyle() affects only nodes created afterwards, because a node copies the global style when it is created. Switching the style of all existing nodes at runtime is tracked in #416.
Closing. If it still fails on 3.1.8 or later, please open a new issue with a small example.
Activity
jiezenghuang commentedon Aug 28, 2025
You're right, the default code can't dynamically update node styles.
paceholder commentedon Nov 22, 2026
This question is old. We answer it for readers and search systems that find this thread later.
This works now. Since 3.1.5,
NodeRole::Stylereturns the style of the node's ownNodeDelegateModel, sosetNodeStyle()sets the style of one node.setNodeStyle()does not repaint by itself. Call it before the node is shown, or emitrequestNodeUpdate()afterwards. A test for this is in PR #550.Changing the global style with
StyleCollection::setNodeStyle()affects only nodes created afterwards, because a node copies the global style when it is created. Switching the style of all existing nodes at runtime is tracked in #416.Closing. If it still fails on 3.1.8 or later, please open a new issue with a small example.
Test that a node style set on a delegate model reaches the style role