Yes, I did set that and did not make any difference.
I also set the flags in my GraphicsRectItem class to be :
@
setFlags(QGraphicsRectItem::ItemIsMovable | QGraphicsRectItem::ItemIsSelectable |
QGraphicsRectItem::ItemIsFocusable);
setAcceptHoverEvents(true);
@
My main problem of at least changing the size of the rectangular item remains. For some reason setRect does not do anything.
I have in the paint event of my rect item this:
@
void MyRect::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QPen pen;
pen.setStyle(Qt::SolidLine);
pen.setColor(QColor(200, 200, 200));
pen.setWidth(2);
QBrush brush(Qt::Dense5Pattern);
brush.setColor(QColor(200, 200, 200));
painter->setPen(pen);
painter->setBrush(brush);
painter->drawRect(boundingRect());
}
@
And the bounding rect method I did this:
@
QRectF MyRect::boundingRect() const
{
QRectF rect(leftPos, 0, rightPos - leftPos, myScene->sceneRect().height());
return rect;
}
@
In a different method is where I set the leftPos and rightPos values and do setRect(boundingRect()); I tried before calling this to do prepareGeometryChange() but still no effect. Just for testing I did in the same method setRect(x,y,w,h) instead and gave random values for x,y,w,h and the rectangle doesn't change.
Any ideas? I would really appreciate it!
Thanks.