Important: Please read the Qt Code of Conduct -

MapToSceneDistance() needed?

  • Is there a way to map distances between coordinate systems? E.G. QGraphicsView.mapToSceneDistance(QPoint). For example, Cairo rendering tool has such a function.

    I had bug in my code, where I was calling mapToScene (incrementalMouseMotion), to implement smooth scrolling. As long as the view and scene coordinate systems are aligned, this returns a proper distance. But once I called view.translate() with that distance, of course I got the typical complaint, my graphic items just danced a little since then the coordinate systems were not aligned on subsequent mouse motions.

    Am I missing something in the API? I know its easy to work around, but it constrains my approach.

Log in to reply