[Interest] Draw multiple rectangles in a QGraphicsItem using the mouse

Michael Sué sue at sf.mpg.de
Mon Oct 26 12:58:55 CET 2015


Hi David,

> However, I have some problems when I actually want to draw rectangles with negatives width and height. I mean when the values of origPoint.x() and 
> origPoint.y() are strictly higher than scenePos().x() and scenePos().y() respectively.

You will have to normalize the rectangle coordinates. There is a QRect method for this. It exchanges coordinates so that width and height is positive. You can set the rectangle then.

- Michael.





More information about the Interest mailing list