[PyKDE] orienting text vertically instead of horizontally
Ingo Krabbe
i.krabbe at dokom.net
Fri Sep 27 10:57:01 BST 2002
On Thu, Sep 26, 2002 at 03:16:20PM -0400, Miller, Douglas K (JFTI) wrote:
> If you have created an object of type QCanvasText, how do you orient the
> text vertically instead of horizontally? I've tried researching it, but I'm
> got no where. Thanks.
>
The solution I found in Qt's documentation is the usage of a 2D
transformation performed through a QWMatrix class. You can see here
how it acts upon a Widget. Below there is a hint about applying a
QWMatrix to a QPixmap. I don't think you can directly use a Matrix upon
a Canvas Item but you might transform the string when it has been drawn
into a pixmap, which than can be used as a QCanvasPixmap.
MyWidget::paintEvent( QPaintEvent * )
{
QPainter p; // our painter
QWMatrix m; // our transformation matrix
m.rotate( 22.5 ); // rotated coordinate system
p.begin( this ); // start painting
p.setWorldMatrix( m ); // use rotated coordinate system
p.drawText( 30,20, "detator" ); // draw rotated text at 30,20
p.end(); // painting done
}
A matrix specifies how to translate, scale, shear or rotate the
graphics; the actual transformation is performed by the drawing routines
in QPainter and by QPixmap::xForm().
BYE INGO
> _______________________________________________
> PyKDE mailing list PyKDE at mats.gmd.de
> http://mats.gmd.de/mailman/listinfo/pykde
>
More information about the PyQt
mailing list