PDA

View Full Version : Whats the right way to link data to a QSGNode?



sheepy
25th November 2014, 15:05
Hello,
currently I'm learning how to create a new QQUickItem with OpenGL Rendering.
With the QQUickItem i want to create a plot.
The plot should represent some data, which contains a id and a x and y coordinate.

Now I'm looking for a clean way, to link the id to the QSGNode.
Can I simple Subclass QSGNode? Or is there a better way to link data to a QSGNode?
Greetings,
sheepy

wysota
25th November 2014, 16:00
Why do you want to link an id to scene-graph node? Nodes are used purely for rendering. Do you want to pass that ID to a shader?

sheepy
25th November 2014, 16:27
No i want to create an interaction screen, where the user can click to a coordinate. When the coordinate is cliked, I want to do somethin with a object, that refers by the id.
Of course, I can create a Map in my QQuickItem that refers the point the object. But if I scale the screen I have some porblems with the mapping
I doesn't know that the node only used for rendering. Thanks for this information

wysota
25th November 2014, 17:24
All data related to the item should be kept within the item (QQuickItem). QSGNode subclasses should only deal with rendering. There is an example in the docs showing how to draw a curve stored as a number of control points in the item.

sheepy
28th November 2014, 01:15
I studied the beziercurve example. Now I know what is to do.

Thank you