Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QRect and wrong rectangle coordinates
JulienD last edited by JulienD
Currently using QT 5.15 and reading Qrect, I just want to make sure of one thing:
yields (for topLeft, topRight, bottomRight, bottomLeft):
QPoint(0,100) QPoint(49,100) QPoint(49,49) QPoint(0,49)
Which is correct (don't care about the -1)
But if I do
QPoint(0,100) QPoint(49,100) QPoint(49,149) QPoint(0,149)
Which is not logical since the topLeft is below the bottomLeft !
So to be correct in all cases (rotation included), should I enforce the minus ? Or will another surprise arise?
Bonnie last edited by Bonnie
What are you talking about?
QPoint(0,149) is below QPoint(0,100) because the GUI coordinate system looks like this:
(picture is from: https://doc.qt.io/qt-5/coordsys.html)
JulienD last edited by
Missed that info. Everything is alright. thanks!
HoMa last edited by
I want to add that the documentation of QRect reads different from your assumption: The consturctor which takes 4 int arguments assums "width" and "height" as last arguments. These are no point coordinates.
QRect(int x, int y, int width, int height)