Incrementing the length of a QLineF in the negative direction?
The documentation seems to be spotty on this. Below is how I did it. Is this the correct way?
QLineF refLine(100,100, 500,500);
QLineF perpLine = refLine.normalVector(); //create a perpendicular line to the refLine
perpLine.setLength(-1); //this seems to set it in the negative direction and it stays in the negative direction
for(int i = 0; i < 50; i++)
perpLine.setLength(perpLine.Length + 1); // this will increment perpLine in a negative direction
i read the docs of QLineF::setLength() pretty clear:
Sets the length of the line to the given length. QLineF will move the end point (p2) of the line to give the line its new length
The following code would rotate the line by 180° (around p1):
QLineF line(100,100, 500,500);
line.setLength( - line.length() );
Thanks for the reply. I always find Qt documentation to be top notch. I'm having trouble inferring from the documentation on this topic to mean negative numbers will invert/rotate the line.