Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Kolyunya last edited by
I don't really know, where to post this, sorry.
I just want to share some thoughts and to know your opinion. While working with Qt I've needed many times to construct a QRect from two random points. This means, I do not know what are they: topLeft or topRight or bottomLeft or bottomRight.
So I think the QRect needs a constructor from two random points. What do you think?
Example: user selects some area on a "desktop", we get two points: where he presses mouse and where he releases it. He can make a selection in any direction.
I do know how to solve this. I'm talking about adding this feature to some or the next releases of Qt. I think it would be useful.
messi last edited by
What you would need is a function which checks from where to where the user selected the area on the desktop. There are four possibilities for a rect. So I don't think that a new constructor in QRect is really necessary but thats only my opinion.
Jeroentjehome last edited by
Hmm, just catch the mouse event and the "start" position and "stop" position would give a positive of negative value. Put those three (2 points and the direction) in a signal and the QRect will be able to be made with the given constructors. The QRect shouldn't have any idea why/how or who did create the rectangle IYAM, but your application might require it anyway.
andre last edited by
So, why don't you do this then?
QRect myRect = QRect(point1, point2).normalized();
I don't think a special constructor is needed for this.
vittalonline last edited by
Andre You are a great Qt Specialist...