I have a QGraphicscene that don’t update screen with negative numbers.The image explain all.
http://s16.postimage.org/4b59m8hx1/problem.jpg
That’s the simple code.
if (dinA){ //assume its always true
int sx=dinA->getX();
int sy=dinA->getY();
dis->scene.addRect(QRectF(300,100-sy, sx, sy),QPen(), QBrush(Qt::FDiagPattern));
}
//** 300,100-sy ** because of my work-area is 600*300
What could be the cause?
If I interpret your screenshot and the text below it correctly, you are using a negative number for the height. However, this creates an invalid
QRectF. Citing from the Qt documentation:In the your code, you should make sure that the size and the width are positive. Otherwise, you have to swap the x- and/or y-coordinate of the corner points.
Hope that helps!