AndyQT
7th November 2012, 20:30
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());
How can I match the coordinate system for the expression above to one of those for mouse click coordinates?:
void MyClass::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QPoint clickCoords = QCursor::pos();
QPointF globalPos = event->screenPos();
...
I'm sorry, this coordinate thing has been discussed so many times, but I can't figure it out.
Andy
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());
How can I match the coordinate system for the expression above to one of those for mouse click coordinates?:
void MyClass::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QPoint clickCoords = QCursor::pos();
QPointF globalPos = event->screenPos();
...
I'm sorry, this coordinate thing has been discussed so many times, but I can't figure it out.
Andy