summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-05-14 15:53:23 +0200
committerArno <am@disconnect.de>2010-05-14 15:53:23 +0200
commit4ec6696968f7536e067e3a728ffdb423f985ef5a (patch)
treea0ec81b2d4bd4ba91a09580e8364cf2759d33aa0
parenta785a3f264c0efad18e3e459158c22af081db9b1 (diff)
downloadSheMov-4ec6696968f7536e067e3a728ffdb423f985ef5a.tar.gz
SheMov-4ec6696968f7536e067e3a728ffdb423f985ef5a.tar.bz2
SheMov-4ec6696968f7536e067e3a728ffdb423f985ef5a.zip
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().
-rw-r--r--shemov.cpp6
1 files changed, 3 insertions, 3 deletions
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<quint64>(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"));