ItemIgnoresTransformations and Positioning it on the Scene.



  • I'm having a bad time trying to center-align ( horizontally and vertically ) a QGraphicsSimpleTextItem that has the ItemIgnoresTransformations flags on.
    @
    item = new QGraphicsLineItem(pos, m.y1(), pos, m.y1() + tickSize, this);
    item->setPen(pen());
    ticks.push_back(item);

    label = new QGraphicsSimpleTextItem(textForValue(currValue), this);
    label->setBrush(QBrush(textColor));
    label->setFlag(ItemIgnoresTransformations);
    labels.push_back(label);
    @

    now, label->setPos ( Xpos - boundingRect().width() / 2, 0) doesn't works because the boundingRect of the item is not affected by the scene transforms. =/


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.