问题
By default QPainter
has its origin point in top-left corner.
I want to draw shapes but all coordinates that I have are in cartesian system.
So my question - how can I change the origin point to bottom-left corner?
Sure, I can scale(1,-1)
but then drawText()
also scaled and prints inverted text. All I nee it just move origin point.
回答1:
QPainter painter(this);
painter.translate(this.rect().bottomLeft());
painter.scale(1.0, -1.0);
回答2:
You can use void QPainter::translate ( const QPointF & offset )
method to change origin coordinate. Check docs here.
来源:https://stackoverflow.com/questions/24014090/change-origin-point-of-qpainter