Important: Please read the Qt Code of Conduct -

ItemIgnoresTransformations setPos

  • Hi, I have a QGraphicsRectItem with 8 resize handles each with the ItemIgnoresTransformations flag set. I set their pos using setPos relative to their parents rect as follows:

    void CanvasItem::updateHandlePositions()
    double hw = m_handleItems[0]->rect().width()/2;
    double hh = m_handleItems[0]->rect().height()/2;

    for (int i = 0; i < m_handleItems.count(); ++i) {
    case CanvasHandle::TopLeft:
    m_handleItems[i]->setPos(rect().left() - hw,
    rect().top() - hh);
    case CanvasHandle::Top:
    rect().top() - hw);

    This sets their positions as shown in a previous post of mine ( The problem is that when I scale the view using the following:

    setTransform(QTransform::fromScale(scale, scale));

    the handle is no longer anchored to the corner of the parent rect:

    ! offset from parent)!

    Can anyone point out what I'm doing wrong?

Log in to reply