diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-20 04:25:27 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-20 04:25:27 (GMT) |
commit | 3eb8f4b9cf8c643d0198ca0af298376b4f1b74e3 (patch) | |
tree | 2b2be51a39c7a57bb98cae0d9d4f55ebfb265822 /src | |
parent | 2f0ebdedbdac619f4ac7638fd215aa4c1f7bb328 (diff) | |
parent | 972134e16767d1ea5224fba911c894eb22b70ca4 (diff) | |
download | Qt-3eb8f4b9cf8c643d0198ca0af298376b4f1b74e3.zip Qt-3eb8f4b9cf8c643d0198ca0af298376b4f1b74e3.tar.gz Qt-3eb8f4b9cf8c643d0198ca0af298376b4f1b74e3.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 17 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativelistview.cpp | 15 |
2 files changed, 24 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index e1874b8..906f1fc 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -679,8 +679,10 @@ void QDeclarativeGridViewPrivate::createHighlight() highlightYAnimator = new QSmoothedAnimation(q); highlightYAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("y")); highlightYAnimator->userDuration = highlightMoveDuration; - highlightXAnimator->restart(); - highlightYAnimator->restart(); + if (autoHighlight) { + highlightXAnimator->restart(); + highlightYAnimator->restart(); + } changed = true; } } @@ -1226,8 +1228,8 @@ void QDeclarativeGridView::setHighlight(QDeclarativeComponent *highlight) id: myHighlight Rectangle { id: wrapper; color: "lightsteelblue"; radius: 4; width: 320; height: 60 - SpringFollow on y { source: Wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 } - SpringFollow on x { source: Wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 } + SpringFollow on y { source: wrapper.GridView.view.currentItem.y; spring: 3; damping: 0.2 } + SpringFollow on x { source: wrapper.GridView.view.currentItem.x; spring: 3; damping: 0.2 } } } \endcode @@ -1243,7 +1245,12 @@ void QDeclarativeGridView::setHighlightFollowsCurrentItem(bool autoHighlight) Q_D(QDeclarativeGridView); if (d->autoHighlight != autoHighlight) { d->autoHighlight = autoHighlight; - d->updateHighlight(); + if (autoHighlight) { + d->updateHighlight(); + } else if (d->highlightXAnimator) { + d->highlightXAnimator->stop(); + d->highlightYAnimator->stop(); + } } } diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 61283df..78c56d6 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -851,13 +851,15 @@ void QDeclarativeListViewPrivate::createHighlight() highlightPosAnimator->target = QDeclarativeProperty(highlight->item, posProp); highlightPosAnimator->velocity = highlightMoveSpeed; highlightPosAnimator->userDuration = highlightMoveDuration; - highlightPosAnimator->restart(); const QLatin1String sizeProp(orient == QDeclarativeListView::Vertical ? "height" : "width"); highlightSizeAnimator = new QSmoothedAnimation(q); highlightSizeAnimator->velocity = highlightResizeSpeed; highlightSizeAnimator->userDuration = highlightResizeDuration; highlightSizeAnimator->target = QDeclarativeProperty(highlight->item, sizeProp); - highlightSizeAnimator->restart(); + if (autoHighlight) { + highlightPosAnimator->restart(); + highlightSizeAnimator->restart(); + } changed = true; } } @@ -1682,7 +1684,14 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight) Q_D(QDeclarativeListView); if (d->autoHighlight != autoHighlight) { d->autoHighlight = autoHighlight; - d->updateHighlight(); + if (autoHighlight) { + d->updateHighlight(); + } else { + if (d->highlightPosAnimator) + d->highlightPosAnimator->stop(); + if (d->highlightSizeAnimator) + d->highlightSizeAnimator->stop(); + } emit highlightFollowsCurrentItemChanged(); } } |