After the coordinate transformation(setRotation()) is how can I get it?
Unsolved
General and Desktop
-
Hello.
I added the QGraphicsScene to QGraphicsLineItem.
and rotate LineItem.How can I rotated a LineItem coordinates ?
< source >
QGraphicsLineItem* pTestLineItem = _scene.addLine( 300, 300, 500, 300, QPen( Qt::red ) );pTestLineItem->setTransformOriginPoint( pTestLineItem->boundingRect().center() );
pTestLineItem->setRotation( 30. );QPointF p1 = pTestLineItem->line().p1();
QPointF p2 = pTestLineItem->line().p2();p1, p2 is no changed.
p1( 300, 300 ) and p2(500, 300 )thanks.
-
Hi, @Daryong
pTestLineItem->line().p1() is origin coordinate before rotated it. Also always returned origin.
If you want to know the rotated coordinates, you must use mapping methods.
Something like this:
QPointF p1 = pTestLineItem->mapToScene(pTestLineItem->line().p1());