[Qt-interest] QGraphicsScene pos
pmqt71
pmqt71 at gmail.com
Tue Oct 26 00:58:26 CEST 2010
Hi,
please help me.
I have a scene with this rect:
myScene->setSceneRect( -50.0, -50.0, 50.0, 50.0 );
on the following event handler, I want the x and y within the scene rect.
void MyGraphicsScene::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *
mouseEvent)
{
QRectF rect = sceneRect(); //this gives -50.0, -50.0, 50.0, 50.0
//but the following returns something out of the sceneRect - e.g. 106,
-91 double-clicking in the top right corner
QPointF pointScene = mouseEvent->lastScenePos ();
// is it a view related point?
QPointF point = this->views()[0]->mapToScene(pointScene.toPoint()); //
but this returns -51, -183
}
The QGraphicsView is added into a layout and the mainWindow is resizable, so
the size of the widget is not fixed.
thanks
pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101026/096c0cb2/attachment.html
More information about the Qt-interest-old
mailing list