[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.0/kdelibs/kdeui/widgets
From: Andras Mantia <amantia () kde ! org>
Date: 2008-01-29 9:48:15
Message-ID: 1201600095.837343.26862.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 768072 by amantia:
Backport the KSqueezedTextLabel width fix.
M +9 -1 ksqueezedtextlabel.cpp
--- branches/KDE/4.0/kdelibs/kdeui/widgets/ksqueezedtextlabel.cpp #768071:768072
@@ -18,6 +18,8 @@
#include "ksqueezedtextlabel.h"
+#include <kglobalsettings.h>
+
class KSqueezedTextLabelPrivate
{
public:
@@ -61,7 +63,13 @@
QSize KSqueezedTextLabel::sizeHint() const
{
- return QSize(contentsRect().width(), QLabel::sizeHint().height());
+ int maxWidth = KGlobalSettings::desktopGeometry( this ).width() * 3 / 4;
+ QFontMetrics fm(fontMetrics());
+ int textWidth = fm.width(d->fullText);
+ if (textWidth > maxWidth) {
+ textWidth = maxWidth;
+ }
+ return QSize(textWidth, QLabel::sizeHint().height());
}
void KSqueezedTextLabel::setText( const QString &text ) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic