Diffstat (limited to 'microkde/kdeui/ksqueezedtextlabel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kdeui/ksqueezedtextlabel.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/microkde/kdeui/ksqueezedtextlabel.cpp b/microkde/kdeui/ksqueezedtextlabel.cpp index 37fa29a..e2c61fd 100644 --- a/microkde/kdeui/ksqueezedtextlabel.cpp +++ b/microkde/kdeui/ksqueezedtextlabel.cpp | |||
@@ -1,52 +1,55 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de> | 2 | Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License version 2 as published by the Free Software Foundation. | 6 | License version 2 as published by the Free Software Foundation. |
7 | 7 | ||
8 | This library is distributed in the hope that it will be useful, | 8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. | 11 | Library General Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License |
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to |
15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
16 | Boston, MA 02111-1307, USA. | 16 | Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include "ksqueezedtextlabel.h" | 19 | #include "ksqueezedtextlabel.h" |
20 | #include <qtooltip.h> | 20 | #include <qtooltip.h> |
21 | //Added by qt3to4: | ||
22 | #include <QResizeEvent> | ||
23 | #include <QLabel> | ||
21 | 24 | ||
22 | KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name ) | 25 | KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name ) |
23 | : QLabel ( parent, name ) { | 26 | : QLabel ( parent, name ) { |
24 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); | 27 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); |
25 | fullText = text; | 28 | fullText = text; |
26 | squeezeTextToLabel(); | 29 | squeezeTextToLabel(); |
27 | } | 30 | } |
28 | 31 | ||
29 | KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name ) | 32 | KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name ) |
30 | : QLabel ( parent, name ) { | 33 | : QLabel ( parent, name ) { |
31 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); | 34 | setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed )); |
32 | } | 35 | } |
33 | 36 | ||
34 | void KSqueezedTextLabel::resizeEvent( QResizeEvent * ) { | 37 | void KSqueezedTextLabel::resizeEvent( QResizeEvent * ) { |
35 | squeezeTextToLabel(); | 38 | squeezeTextToLabel(); |
36 | } | 39 | } |
37 | 40 | ||
38 | QSize KSqueezedTextLabel::minimumSizeHint() const | 41 | QSize KSqueezedTextLabel::minimumSizeHint() const |
39 | { | 42 | { |
40 | QSize sh = QLabel::minimumSizeHint(); | 43 | QSize sh = QLabel::minimumSizeHint(); |
41 | sh.setWidth(-1); | 44 | sh.setWidth(-1); |
42 | return sh; | 45 | return sh; |
43 | } | 46 | } |
44 | 47 | ||
45 | void KSqueezedTextLabel::setText( const QString &text ) { | 48 | void KSqueezedTextLabel::setText( const QString &text ) { |
46 | fullText = text; | 49 | fullText = text; |
47 | squeezeTextToLabel(); | 50 | squeezeTextToLabel(); |
48 | } | 51 | } |
49 | 52 | ||
50 | void KSqueezedTextLabel::squeezeTextToLabel() { | 53 | void KSqueezedTextLabel::squeezeTextToLabel() { |
51 | QFontMetrics fm(fontMetrics()); | 54 | QFontMetrics fm(fontMetrics()); |
52 | int labelWidth = size().width(); | 55 | int labelWidth = size().width(); |