7
我一直在玩弄這段代碼:爲什麼的QGraphicsItem :: scenePos()回頭率(0,0)
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()
應該返回場景中線的位置,而不是它在本地座標系內的位置。我究竟做錯了什麼?
我花了一個下午狩獵這件事!非常感謝! (即使這個線程是3歲) – HWende 2012-06-20 14:01:22