diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-27 04:56:51 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-27 04:56:51 (GMT) |
commit | 94df405ad87f61fba470773ea8bba204c355b368 (patch) | |
tree | b8c5402b1a4d6da9f7b8baa2bc63960f1b2f578f /src/declarative | |
parent | c7d38a49bb0c6ea928ce2a54116816ed49dbcfb7 (diff) | |
parent | dd6262e2c4e977f7a02cd8bdc740a08adb0cad49 (diff) | |
download | Qt-94df405ad87f61fba470773ea8bba204c355b368.zip Qt-94df405ad87f61fba470773ea8bba204c355b368.tar.gz Qt-94df405ad87f61fba470773ea8bba204c355b368.tar.bz2 |
Merge branch 'kinetic-declarativeui' of scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicslistview.cpp | 12 | ||||
-rw-r--r-- | src/declarative/qml/qml.h | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 0224465..7d0b99a 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -1716,15 +1716,14 @@ void QmlGraphicsListView::decrementCurrentIndex() void QmlGraphicsListView::positionViewAtIndex(int index) { Q_D(QmlGraphicsListView); - if (index < 0 || index >= d->model->count()) + if (!d->isValid() || index < 0 || index >= d->model->count()) return; + qreal maxExtent = d->orient == QmlGraphicsListView::Vertical ? -maxYExtent() : -maxXExtent(); FxListItem *item = d->visibleItem(index); if (item) { // Already created - just move to top of view - int pos = item->position(); - if (item->position() > -maxYExtent()) - pos = -maxYExtent(); + int pos = qMin(item->position(), maxExtent); d->setPosition(pos); } else { int pos = d->positionAt(index); @@ -1734,8 +1733,9 @@ void QmlGraphicsListView::positionViewAtIndex(int index) d->visiblePos = pos; d->visibleIndex = index; d->setPosition(pos); - if (d->position() > -maxYExtent()) - d->setPosition(-maxYExtent()); + // setPosition() will cause refill. Adjust if we have moved beyond range. + if (d->position() > maxExtent) + d->setPosition(maxExtent); // now release the reference to all the old visible items. for (int i = 0; i < oldVisible.count(); ++i) d->releaseItem(oldVisible.at(i)); diff --git a/src/declarative/qml/qml.h b/src/declarative/qml/qml.h index 2c03aad..323525b 100644 --- a/src/declarative/qml/qml.h +++ b/src/declarative/qml/qml.h @@ -91,7 +91,7 @@ QT_BEGIN_NAMESPACE #define QML_DEFINE_INTERFACE(INTERFACE) \ static int defineInterface##INTERFACE = qmlRegisterInterface<INTERFACE>(#INTERFACE); -#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERS, NAME, TYPE, EXTENSION) \ +#define QML_DEFINE_EXTENDED_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE, EXTENSION) \ static int registerExtended##TYPE = qmlRegisterExtendedType<TYPE,EXTENSION>(#URI, VERSION_MAJ, VERSION_MIN, #NAME, #TYPE); #define QML_DEFINE_TYPE(URI, VERSION_MAJ, VERSION_MIN, NAME, TYPE) \ |