diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-11-16 03:58:05 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-11-16 03:58:05 (GMT) |
commit | d5a981b987eeac7bce9520ef6a3c45c5bb3e2d48 (patch) | |
tree | bb13275f87b847f6a73d852cae08d0d7b44d25eb /src/declarative | |
parent | b315f5ac9ae996f8e1caab314236cea7baa25ae0 (diff) | |
download | Qt-d5a981b987eeac7bce9520ef6a3c45c5bb3e2d48.zip Qt-d5a981b987eeac7bce9520ef6a3c45c5bb3e2d48.tar.gz Qt-d5a981b987eeac7bce9520ef6a3c45c5bb3e2d48.tar.bz2 |
More ListView tests.
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsgridview.cpp | 23 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicslistview.cpp | 28 |
2 files changed, 31 insertions, 20 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp index 29eb983..9465c4c 100644 --- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp @@ -843,6 +843,9 @@ QmlComponent *QmlGraphicsGridView::delegate() const void QmlGraphicsGridView::setDelegate(QmlComponent *delegate) { Q_D(QmlGraphicsGridView); + if (delegate == this->delegate()) + return; + if (!d->ownModel) { d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; @@ -944,9 +947,11 @@ QmlComponent *QmlGraphicsGridView::highlight() const void QmlGraphicsGridView::setHighlight(QmlComponent *highlight) { Q_D(QmlGraphicsGridView); - delete d->highlightComponent; - d->highlightComponent = highlight; - d->updateCurrent(d->currentIndex); + if (highlight != d->highlightComponent) { + delete d->highlightComponent; + d->highlightComponent = highlight; + d->updateCurrent(d->currentIndex); + } } /*! @@ -978,12 +983,14 @@ bool QmlGraphicsGridView::highlightFollowsCurrentItem() const void QmlGraphicsGridView::setHighlightFollowsCurrentItem(bool autoHighlight) { Q_D(QmlGraphicsGridView); - d->autoHighlight = autoHighlight; - if (d->highlightXAnimator) { - d->highlightXAnimator->setEnabled(d->autoHighlight); - d->highlightYAnimator->setEnabled(d->autoHighlight); + if (d->autoHighlight != autoHighlight) { + d->autoHighlight = autoHighlight; + if (d->highlightXAnimator) { + d->highlightXAnimator->setEnabled(d->autoHighlight); + d->highlightYAnimator->setEnabled(d->autoHighlight); + } + d->updateHighlight(); } - d->updateHighlight(); } /*! diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index edcd094..c075a8a 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -1158,6 +1158,8 @@ QmlComponent *QmlGraphicsListView::delegate() const void QmlGraphicsListView::setDelegate(QmlComponent *delegate) { Q_D(QmlGraphicsListView); + if (delegate == this->delegate()) + return; if (!d->ownModel) { d->model = new QmlGraphicsVisualDataModel(qmlContext(this)); d->ownModel = true; @@ -1263,9 +1265,11 @@ QmlComponent *QmlGraphicsListView::highlight() const void QmlGraphicsListView::setHighlight(QmlComponent *highlight) { Q_D(QmlGraphicsListView); - delete d->highlightComponent; - d->highlightComponent = highlight; - d->updateCurrent(d->currentIndex); + if (highlight != d->highlightComponent) { + delete d->highlightComponent; + d->highlightComponent = highlight; + d->updateCurrent(d->currentIndex); + } } /*! @@ -1295,12 +1299,14 @@ bool QmlGraphicsListView::highlightFollowsCurrentItem() const void QmlGraphicsListView::setHighlightFollowsCurrentItem(bool autoHighlight) { Q_D(QmlGraphicsListView); - d->autoHighlight = autoHighlight; - if (d->highlightPosAnimator) { - d->highlightPosAnimator->setEnabled(d->autoHighlight); - d->highlightSizeAnimator->setEnabled(d->autoHighlight); + if (d->autoHighlight != autoHighlight) { + d->autoHighlight = autoHighlight; + if (d->highlightPosAnimator) { + d->highlightPosAnimator->setEnabled(d->autoHighlight); + d->highlightSizeAnimator->setEnabled(d->autoHighlight); + } + d->updateHighlight(); } - d->updateHighlight(); } /*! @@ -1520,8 +1526,7 @@ qreal QmlGraphicsListView::highlightMoveSpeed() const void QmlGraphicsListView::setHighlightMoveSpeed(qreal speed) { Q_D(QmlGraphicsListView);\ - if (d->highlightMoveSpeed != speed) - { + if (d->highlightMoveSpeed != speed) { d->highlightMoveSpeed = speed; if (d->highlightPosAnimator) d->highlightPosAnimator->setVelocity(d->highlightMoveSpeed); @@ -1538,8 +1543,7 @@ qreal QmlGraphicsListView::highlightResizeSpeed() const void QmlGraphicsListView::setHighlightResizeSpeed(qreal speed) { Q_D(QmlGraphicsListView);\ - if (d->highlightResizeSpeed != speed) - { + if (d->highlightResizeSpeed != speed) { d->highlightResizeSpeed = speed; if (d->highlightSizeAnimator) d->highlightSizeAnimator->setVelocity(d->highlightResizeSpeed); |