PDA

View Full Version : Text rotation in QPainter



acpRobert
26th April 2009, 01:43
Can I rotate text in the QPainter of a QFrame?

I was able to rotate the painter but that gets a bit complicated. I've made a QFrame that represents the Y-axis of a chart and I'd like to put the label name rotated 90 degrees.

I've been using PyQt4 for about a week and have been really happy with the ease of use, and dynamite functionality but this has me stuck -- it's got to be simple but I can't find the info.

Thanks ,

Rob

fullmetalcoder
29th April 2009, 21:07
I'm not familiar with PyQt but I suppose the API should be close to that of Qt so QPainter (http://doc.trolltech.com/latest/qpainter.html) should expose several methods to transform its coordinate system which will allow you to draw text any way you want :


QPainter::rotate(qreal) (http://doc.trolltech.com/latest/qpainter.html#rotate)
QPainter::scale(qreal, qreal) (http://doc.trolltech.com/latest/qpainter.html#scale)
QPainter::shear(qreal, qreal) (http://doc.trolltech.com/latest/qpainter.html#shear)