summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativepath.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-01-06 09:28:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-01-06 09:28:55 (GMT)
commita6a8bee86f7e13d49d9115eb33aaee999bd15ad5 (patch)
tree6965ebdba00a655ee879bc969986cd24753c6823 /src/declarative/graphicsitems/qdeclarativepath.cpp
parent97e045f48a331ff97b87bd207fb811277a4fa695 (diff)
parent05b9137fe1974aa123ce6d9c16b733e1f77d8269 (diff)
downloadQt-a6a8bee86f7e13d49d9115eb33aaee999bd15ad5.zip
Qt-a6a8bee86f7e13d49d9115eb33aaee999bd15ad5.tar.gz
Qt-a6a8bee86f7e13d49d9115eb33aaee999bd15ad5.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: PathView crashed when the path is provided with undefined values. PathView: update modelCount before attempting to regenerate delegates.
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepath.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativepath.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp
index 966c51b..e63a2c3 100644
--- a/src/declarative/graphicsitems/qdeclarativepath.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepath.cpp
@@ -46,6 +46,8 @@
#include <QTime>
#include <private/qbezier_p.h>
+#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
QT_BEGIN_NAMESPACE
@@ -367,9 +369,11 @@ void QDeclarativePath::createPointCache() const
{
Q_D(const QDeclarativePath);
qreal pathLength = d->_path.length();
+ if (pathLength <= 0 || qIsNaN(pathLength))
+ return;
// more points means less jitter between items as they move along the
// path, but takes longer to generate
- const int points = int(pathLength*5);
+ const int points = qCeil(pathLength*5);
const int lastElement = d->_path.elementCount() - 1;
d->_pointCache.resize(points+1);
@@ -418,6 +422,8 @@ QPointF QDeclarativePath::pointAt(qreal p) const
Q_D(const QDeclarativePath);
if (d->_pointCache.isEmpty()) {
createPointCache();
+ if (d->_pointCache.isEmpty())
+ return QPointF();
}
int idx = qRound(p*d->_pointCache.size());
if (idx >= d->_pointCache.size())