mvbhavsar
28th January 2015, 19:43
Hello,
I have following code which gives me wrong output
MyRect::MyRect(QGraphicsItem *parent):QGraphicsRectItem(parent)
{
setRect(0,0,100,100);
qDebug() << "Bounding rect is " << boundingRect();
}
And the output is as follows.
Bounding rect is QRectF(-0.5,-0.5 101x101)
Why x,y,width and height has changed than what I set. Because of this change, this item move topside when x,y,width and height is added with some factor at runtime.
Regards
Manish
I have following code which gives me wrong output
MyRect::MyRect(QGraphicsItem *parent):QGraphicsRectItem(parent)
{
setRect(0,0,100,100);
qDebug() << "Bounding rect is " << boundingRect();
}
And the output is as follows.
Bounding rect is QRectF(-0.5,-0.5 101x101)
Why x,y,width and height has changed than what I set. Because of this change, this item move topside when x,y,width and height is added with some factor at runtime.
Regards
Manish