Hello!
I have some problems with coordinates. I have a QGraphicsScene in a QGraphicsView and on the scene there is a QGraphicsItem. I retrieve the center coordinates of the bounding box
QPointF coords
= this
->mapToScene
(this
->boundingRect
().
center());
QPointF coords= this->mapToScene(this->boundingRect().center());
To copy to clipboard, switch view to plain text mode
How can I match the coordinate system for the expression above to one of those for mouse click coordinates?:
{
QPointF globalPos
= event
->screenPos
();
...
void MyClass::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QPoint clickCoords = QCursor::pos();
QPointF globalPos = event->screenPos();
...
To copy to clipboard, switch view to plain text mode
I'm sorry, this coordinate thing has been discussed so many times, but I can't figure it out.
Andy
Bookmarks