fix setText memleak

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=642193
This commit is contained in:
Siraj Razick 2007-03-13 16:16:26 +00:00
parent 2936a021cc
commit 6b2b055830

View File

@ -115,13 +115,18 @@ void PushButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
void PushButton::setText(const QString& text)
{
d->labelText = text;
/*
QFont * font = new QFont (text);
QFontMetrics * fm = new QFontMetrics(*font);
if (fm->width(text) >= d->width)
setWidth(fm->width(d->labelText) + 4);
delete fm;
delete font;
*/
QFont font(text);
QFontMetrics fm(font);
if (fm.width(text) >= d->width)
setWidth(fm.width(text) + 4);
}
QString PushButton::text() const
{
return d->labelText;