Calculate percentage correctly when minimum != 0

svn path=/trunk/KDE/kdelibs/; revision=1048282
This commit is contained in:
Petri Damstén 2009-11-13 01:37:29 +00:00
parent 702920c810
commit 9865c3f8d4

View File

@ -166,7 +166,7 @@ public:
if (image->hasElement("background-center")) {
QRectF elementRect = barRect();
if (elementRect.isEmpty()) {
return; // nothing to be done
return; // nothing to be done
}
QSize imageSize = image->size();
@ -483,7 +483,7 @@ void Meter::paint(QPainter *p,
}
if (d->maximum != d->minimum) {
percentage = (qreal)d->value / (d->maximum - d->minimum);
percentage = (qreal)(d->value - d->minimum) / (d->maximum - d->minimum);
}
p->setRenderHint(QPainter::SmoothPixmapTransform);