【发布时间】:2010-11-12 05:13:58
【问题描述】:
我一直在玩弄这段代码:
QGraphicsLineItem * anotherLine = this->addLine(50,50, 100, 100);
qDebug() << anotherLine->scenePos();
QGraphicsLineItem * anotherLine2 = this->addLine(80,10, 300, 300);
qDebug() << anotherLine2->scenePos();
this 指针指向QGraphicsScene。在这两种情况下,我都得到QPointF(0,0) 的两个输出。
通过阅读文档,我认为scenePos() 应该返回场景中线条的位置,而不是它在其局部坐标系中的位置。我做错了什么?
【问题讨论】:
标签: c++ qt qgraphicsitem qgraphicsscene