Vertical text (Was: Re: kmix maintanence - please direct bugreports to me)

Christian Esken c.esken at cityweb.de
Thu Apr 24 11:04:45 BST 2003


Am Thursday 24 April 2003 09:18 schrieb Arnold Krille:
> On Wednesday 23 April 2003 23:27, Christian Esken wrote:
> > BTW: Do we have a widget that shows vertical text?
> > This is really needed for kmix, as showing horizontal labels makes kmix
> > to wide, especially with ALSA (cards often have there 30, 40 or more
> > controls).
>
> Could such a label be made public? I would need such one in aRts for the
> Mixers...

If there are >2 applications demanding this, it might be a good idea. But 
there are easy ways to do this. See my prototype implementation (it still 
lacks resizing and I probably want built-in tooltips and the "..." style for 
texts too long to fit. Here's my complete prototype implementation (the only 
tricky part is giving the x- and y-Positions, due to the coordinate 
transformation):

VerticalText::VerticalText(QWidget * parent, const char * name, WFlags f) : 
QWidget(parent,name,f)
{
        resize(20,100 /*parent->height() */ );
        setFixedSize(20,100);
}

VerticalText::~VerticalText() {
}

void VerticalText::paintEvent ( QPaintEvent * /*event*/ ) {
        QPainter paint(this);
        paint.rotate(270);
        paint.drawText(-height()+2,width(),name());
}

Chris






More information about the kde-core-devel mailing list