1 | /*
|
---|
2 | * KMix -- KDE's full featured mini mixer
|
---|
3 | *
|
---|
4 | *
|
---|
5 | * Copyright (C) 2003-2004 Christian Esken <esken@kde.org>
|
---|
6 | *
|
---|
7 | * This program is free software; you can redistribute it and/or
|
---|
8 | * modify it under the terms of the GNU Library General Public
|
---|
9 | * License as published by the Free Software Foundation; either
|
---|
10 | * version 2 of the License, or (at your option) any later version.
|
---|
11 | *
|
---|
12 | * This program is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
15 | * Library General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU Library General Public
|
---|
18 | * License along with this program; if not, write to the Free
|
---|
19 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #include "verticaltext.h"
|
---|
23 | #include <QPainter>
|
---|
24 | #include <QPaintEvent>
|
---|
25 | /*#include <kdebug.h>*/
|
---|
26 |
|
---|
27 |
|
---|
28 | VerticalText::VerticalText(QWidget * parent, Qt::WindowFlags f)
|
---|
29 | : QWidget(parent, f)
|
---|
30 | {
|
---|
31 | resize(20,100 /*parent->height() */ );
|
---|
32 | setMinimumSize(20,10); // neccesary for smooth integration into layouts (we only care for the widths).
|
---|
33 | }
|
---|
34 |
|
---|
35 | VerticalText::~VerticalText() {
|
---|
36 | }
|
---|
37 |
|
---|
38 |
|
---|
39 | void VerticalText::paintEvent ( QPaintEvent * /*event*/ ) {
|
---|
40 | //kdDebug(67100) << "paintEvent(). height()=" << height() << "\n";
|
---|
41 | QPainter paint(this);
|
---|
42 | paint.rotate(270);
|
---|
43 | // Fix for bug 72520
|
---|
44 | //- paint.drawText(-height()+2,width(),name());
|
---|
45 | //+ paint.drawText( -height()+2, width(), QString::fromUtf8(name()) );
|
---|
46 | paint.drawText( -height()+2, width(), _label );
|
---|
47 | }
|
---|
48 |
|
---|
49 | QSize VerticalText::sizeHint() const {
|
---|
50 | return QSize(20,100); // !! UGLY. Should be reworked
|
---|
51 | }
|
---|
52 |
|
---|
53 | QSizePolicy VerticalText::sizePolicy () const
|
---|
54 | {
|
---|
55 | return QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
---|
56 | }
|
---|