From 4ec6696968f7536e067e3a728ffdb423f985ef5a Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 14 May 2010 15:53:23 +0200 Subject: Fix bug in setFsFree() Make height of QLabel dependent on font size instead of its own heigt. The latter makes it grow in height from every call to setFsFree(). --- shemov.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'shemov.cpp') diff --git a/shemov.cpp b/shemov.cpp index d111a2d..2e3ab90 100644 --- a/shemov.cpp +++ b/shemov.cpp @@ -194,7 +194,9 @@ void SheMov::setFsFree(){ int used = avail - free; qreal freep = free * 100.0 / avail; qreal usedp = used * 100.0 / avail; - int height = mFsFree->size().height(); + QFont f = qApp->font(); + QFontMetrics fm(f); + int height = fm.height() + 3; QImage img(100, height, QImage::Format_ARGB32); img.fill(0); QPainter p(&img); @@ -205,8 +207,6 @@ void SheMov::setFsFree(){ p.drawRect(QRectF(usedp, 0, freep, height)); quint64 freeb = static_cast(free) * blocksize; qreal freegib = freeb / 1024.0 / 1024.0 / 1024.0; - QFont f = qApp->font(); - QFontMetrics fm(f); QLocale l; QString freeString = l.toString(freegib, 'g', 2); freeString.append(tr(" GiB free")); -- cgit v1.2.3-70-g09d2