fix setText memleak
svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=642193
This commit is contained in:
parent
2936a021cc
commit
6b2b055830
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user