0
我有一個QGraphicsRectItem的子類。 mouseMoveEvent處理程序如下所示:如何在mouseMove中獲取QGraphicsRectItem的位置?
void BTNodeGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
QGraphicsRectItem::mouseMoveEvent(event);
qDebug() << rect().x() << " " << rect().y();
}
該項目拖動像我期望的一樣。但是,當我拖動它時,qDebug語句會輸出相同的座標。不應該因爲被拖動而改變?
這很有效,謝謝! – Almo