How to change cordinate sistem in QGraphicsItem
-
I want to plot my custom item inside a chart.
The cordinates of the components inside the object are in the chart's cordinate system, not the scene.
How do I make this conversion? The example of my problem can be found in this link: https://stackoverflow.com/questions/75573360/qt-change-of-cordinates-for-qgraphicsitem -
mapToScene(Point)
mapFromScene(Point)
mapToGlobal(Point)
mapFromGlobal(Point)
or the basic
mapTo(someWidget, Point)
/mapFrom(someWidget, Point)
Edit:
After looking at your code, dont map your boundingRect to scene. It's in item coordinates.What do you get and what do you expect?
-
@Pl45m4 I wanted to create my custom object to be displayed on the chart, and later possibly implementing a custom series for that object, messing with these conversion functions eventually made my code work, but I wanted an all rounded solution.
-
Either I haven't figured out, what you are doing or it's complete nonsense (esp. the
boundingRect
)
Maybe you can add the rest of your code and a screenshot of how your result looks.@ugo_ said in How to change cordinate sistem in QGraphicsItem:
I want to plot my custom item inside a chart.
Are you talking about
QChart
? So you have aQChart
and want your item in your chart?!