What is the purpose of passing negative values to the QRect constructor for the x and y parameters?
Example:
painter.
setRenderHint(QPainter::Antialiasing, antialiased
);
painter.translate(width() / 2, height() / 2);
for (int diameter = 0; diameter < 256; diameter += 9)
{
painter.
drawEllipse(QRectF(-diameter
/ 2.0,
-diameter
/ 2.0, diameter, diameter
));
}
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing, antialiased);
painter.translate(width() / 2, height() / 2);
for (int diameter = 0; diameter < 256; diameter += 9)
{
painter.drawEllipse(QRectF(-diameter / 2.0, -diameter / 2.0, diameter, diameter));
}
To copy to clipboard, switch view to plain text mode
The code above draws a series of concentric circles centered at a fixed point. If I change to positive values, the center of each circle moves, drawing a 'cone effect' on the screen.
My question is what does negating the x and y arguments really do?
I have searched a lot for this topic but nothing comes up that really answers my question.
Thanks.
Bookmarks