[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyKDE] orienting text vertically instead of horizontally
From: Ingo Krabbe <i.krabbe () dokom ! net>
Date: 2002-09-27 8:57:34
[Download RAW message or body]
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@mats.gmd.de
> http://mats.gmd.de/mailman/listinfo/pykde
>
_______________________________________________
PyKDE mailing list PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic