comparing doubles for equality with == isn't great

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=696628
This commit is contained in:
Aaron J. Seigo 2007-08-05 12:58:40 +00:00
parent 8d7e06a09d
commit b1d1f1959f

View File

@ -20,11 +20,13 @@
#include "widget.h"
#include <KDebug>
#include <limits>
#include <QtCore/QList>
#include <QPainter>
#include <KDebug>
#include "layout.h"
#include "plasma/plasma.h"
@ -52,7 +54,7 @@ class Widget::Private
bool Widget::Private::shouldPaint(QPainter *painter, const QTransform &transform)
{
qreal zoomLevel = painter->transform().m11() / transform.m11();
return zoomLevel == scalingFactor(Plasma::DesktopZoom);
return (zoomLevel - scalingFactor(Plasma::DesktopZoom)) < std::numeric_limits<double>::epsilon();
}
Widget::Widget(QGraphicsItem *parent)