Skip to content

StyleManager vs. Node::style() vs. NodeItem::getStyle() #234

@emmenlau

Description

@emmenlau

I would like to style individual nodes with distinct styles. However this is not working as I would expect. Here is what I'm doing:

auto* vNode = qanGraph->insertNode<myNodeType>();
qan::NodeItem* vNodeItem = vNode->getItem();
qan::NodeStyle* vNodeStyle = new qan::NodeStyle(vNodeItem);
vNodeStyle->setBorderColor(QColor(100, 100, 200, 255));
vNodeItem->setStyle(vNodeStyle);

The items will all use the default node style, rather than my custom node style. I tried to follow this up in the code, but I'm quite a bit lost between StyleManager, Node::style() and NodeItem::getStyle().

After a longer investigation, it seems that in QML I override the default style, when the component is completed. This override of the default style seems to modify how my graph is rendered. If I do not override the defaults in QML, everything works fine and the C++ style is respected.

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