summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@nokia.com>2010-02-01 17:38:35 (GMT)
committerMarco Bubke <marco.bubke@nokia.com>2010-02-01 18:33:09 (GMT)
commit652be80c25f61aa4fbf28d75ba9971fc709f29c9 (patch)
tree835afbb38bc2a17b2b7fa28a3c34b8b58d9b1369
parentd28d9c1d6e2c54cf41a9cc52f41b0542cb9717aa (diff)
downloadQt-652be80c25f61aa4fbf28d75ba9971fc709f29c9.zip
Qt-652be80c25f61aa4fbf28d75ba9971fc709f29c9.tar.gz
Qt-652be80c25f61aa4fbf28d75ba9971fc709f29c9.tar.bz2
Tests for NaN values in the property x, y, widht and height setters of
QGraphicsItem and QmlGraphicsItem Task-number: BAUHAUS-268 Reviewed-by: Thomas Hartmann
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp6
2 files changed, 14 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index 2f0c555..6835427 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -62,6 +62,8 @@
#include <QtGui/qgraphicseffect.h>
#include <qlistmodelinterface_p.h>
+#include <math.h>
+
QT_BEGIN_NAMESPACE
#ifndef FLT_MAX
@@ -2843,6 +2845,9 @@ qreal QmlGraphicsItem::width() const
void QmlGraphicsItem::setWidth(qreal w)
{
Q_D(QmlGraphicsItem);
+ if (isnan(w))
+ return;
+
d->widthValid = true;
if (d->width == w)
return;
@@ -2912,6 +2917,9 @@ qreal QmlGraphicsItem::height() const
void QmlGraphicsItem::setHeight(qreal h)
{
Q_D(QmlGraphicsItem);
+ if (isnan(h))
+ return;
+
d->heightValid = true;
if (d->height == h)
return;
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index c53a893..3d81021 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3425,6 +3425,9 @@ void QGraphicsItem::setX(qreal x)
if (d_ptr->inDestructor)
return;
+ if (isnan(x))
+ return;
+
d_ptr->setPosHelper(QPointF(x, d_ptr->pos.y()));
}
@@ -3449,6 +3452,9 @@ void QGraphicsItem::setY(qreal y)
if (d_ptr->inDestructor)
return;
+ if (isnan(y))
+ return;
+
d_ptr->setPosHelper(QPointF(d_ptr->pos.x(), y));
}