Skip to content

NodeDataModel::setNodeStyle() is of no effect #377

Closed

Description

@scarsty

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?

Activity

  1. jiezenghuang commented on Aug 28, 2025

    @jiezenghuang

    You're right, the default code can't dynamically update node styles.

  2. paceholder commented on Nov 22, 2026

    @paceholder
    Owner

    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.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions