Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
emmenlau opened this issue Jul 23, 2024 · 0 comments
Open

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

emmenlau opened this issue Jul 23, 2024 · 0 comments

Comments

@emmenlau
Copy link
Contributor

emmenlau commented Jul 23, 2024

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.

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

No branches or pull requests

1 participant