Function(QPoint, QPoint) return (int, int, int, int) ?
Unsolved
General and Desktop
-
4 directions of draw rect with mouse, change to direction of top-left to bottom-right.
Why QPainter.drawRect(QRect) do not need to consider direction ?
https://github.com/sonichy/HTYPaint_Qt/blob/master/imagewidget.cpp#L738int xs, ys, xe, ye; if(startPnt.x()<endPnt.x() && startPnt.y()<endPnt.y()){xs=startPnt.x(); ys=startPnt.y(); xe=endPnt.x(); ye=endPnt.y();} if(startPnt.x()>endPnt.x() && startPnt.y()<endPnt.y()){xs=endPnt.x(); ys=startPnt.y(); xe=startPnt.x(); ye=endPnt.y();} if(startPnt.x()>endPnt.x() && startPnt.y()>endPnt.y()){xs=endPnt.x(); ys=endPnt.y(); xe=startPnt.x(); ye=startPnt.y();} if(startPnt.x()<endPnt.x() && startPnt.y()>endPnt.y()){xs=startPnt.x(); ys=endPnt.y(); xe=endPnt.x(); ye=startPnt.y();}
-
Hi, looking at the code, I think the 4 if statements are not for helping QPainter.drawRect() with its correct direction, but rather to simplify the drawing logic (you know you're always stepping in the +x and +y directions when building the mosaic).