diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-06 20:05:55 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-06 20:05:55 (GMT) |
commit | 4dd54e88efc6899a0024ddb1412c4093d7d4aebb (patch) | |
tree | b7ea7af33d75d27d104d736b77d08579635d1f95 /src/declarative/graphicsitems/qdeclarativepath.cpp | |
parent | 349a6ff44c8c6e6560d709975c1521964fd1fc27 (diff) | |
parent | 436ce764bada3e8fe3c9d4e7322f38f41e95324c (diff) | |
download | Qt-4dd54e88efc6899a0024ddb1412c4093d7d4aebb.zip Qt-4dd54e88efc6899a0024ddb1412c4093d7d4aebb.tar.gz Qt-4dd54e88efc6899a0024ddb1412c4093d7d4aebb.tar.bz2 |
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration:
PathView crashed when the path is provided with undefined values.
PathView: update modelCount before attempting to regenerate delegates.
Update docs - calling overloaded functions from QML is now supported
Doc fixes for introduction page and Item docs
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativepath.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativepath.cpp | 8 |
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()) |