summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp17
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp15
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();
}
}