Qt code is quite different:
{
return d_ptr->pos;
}
{
return mapToScene(0, 0);
}
{
QTransform m = transform() * QTransform().translate(d_ptr->pos.x(), d_ptr->pos.y());
if (d_ptr->parent)
return m * d_ptr->parent->sceneTransform();
return m;
}
{
if (!d_ptr->hasTransform)
return QTransform();
return qVariantValue<QTransform>(d_ptr->extra(QGraphicsItemPrivate::ExtraTransform));
}
QPointF QGraphicsItem::pos() const
{
return d_ptr->pos;
}
QPointF QGraphicsItem::scenePos() const
{
return mapToScene(0, 0);
}
QTransform QGraphicsItem::sceneTransform() const
{
QTransform m = transform() * QTransform().translate(d_ptr->pos.x(), d_ptr->pos.y());
if (d_ptr->parent)
return m * d_ptr->parent->sceneTransform();
return m;
}
QTransform QGraphicsItem::transform() const
{
if (!d_ptr->hasTransform)
return QTransform();
return qVariantValue<QTransform>(d_ptr->extra(QGraphicsItemPrivate::ExtraTransform));
}
To copy to clipboard, switch view to plain text mode
if transform() has translation (dx, dy) and other components, then some problem how to make setPos() correctly...
Bookmarks