summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-09 02:44:02 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-09 02:44:02 (GMT)
commit8fdcde8025100b56dcf33ebc9865ac3f3db3770f (patch)
tree3859d75a4c62fe2cd1d84727a55e6e6bd8d54ea2
parentfe4c978f90986e52a64a28a42f3445c620a1f5ef (diff)
parent16a4138a74a1965ecb04fdf1957273f6e8c22071 (diff)
downloadQt-8fdcde8025100b56dcf33ebc9865ac3f3db3770f.zip
Qt-8fdcde8025100b56dcf33ebc9865ac3f3db3770f.tar.gz
Qt-8fdcde8025100b56dcf33ebc9865ac3f3db3770f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp16
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp17
6 files changed, 26 insertions, 22 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 60ffbe2..f35b903 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -755,14 +755,15 @@ void QDeclarativeGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal m
vTime = timeline.time();
}
} else if (snapMode != QDeclarativeGridView::NoSnap) {
- qreal pos = qMax(qMin(snapPosAt(position()) - highlightRangeStart, -maxExtent), -minExtent);
- qreal dist = qAbs(data.move + pos);
+ qreal pos = -snapPosAt(-(data.move.value() - highlightRangeStart)) + highlightRangeStart;
+ pos = qMin(qMax(pos, maxExtent), minExtent);
+ qreal dist = qAbs(data.move.value() - pos);
if (dist > 0) {
timeline.reset(data.move);
if (fixupDuration)
- timeline.move(data.move, -pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
+ timeline.move(data.move, pos, QEasingCurve(QEasingCurve::InOutQuad), fixupDuration/2);
else
- data.move.setValue(-pos);
+ data.move.setValue(pos);
vTime = timeline.time();
}
} else {
@@ -788,7 +789,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (FxGridItem *item = firstVisibleItem())
maxDistance = qAbs(item->rowPos() + data.move.value());
} else if (data.move.value() < minExtent) {
- maxDistance = qAbs(minExtent - data.move.value() + (overShoot?overShootDistance(velocity, vSize):0));
+ maxDistance = qAbs(minExtent - data.move.value());
}
if (snapMode != QDeclarativeGridView::SnapToRow && highlightRange != QDeclarativeGridView::StrictlyEnforceRange)
data.flickTarget = minExtent;
@@ -797,7 +798,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
qreal pos = snapPosAt(-data.move.value()) + rowSize();
maxDistance = qAbs(pos + data.move.value());
} else if (data.move.value() > maxExtent) {
- maxDistance = qAbs(maxExtent - data.move.value()) + (overShoot?overShootDistance(velocity, vSize):0);
+ maxDistance = qAbs(maxExtent - data.move.value());
}
if (snapMode != QDeclarativeGridView::SnapToRow && highlightRange != QDeclarativeGridView::StrictlyEnforceRange)
data.flickTarget = maxExtent;
@@ -816,7 +817,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
qreal maxAccel = v2 / (2.0f * maxDistance);
qreal overshootDist = 0.0;
if (maxAccel < accel) {
- qreal dist = v2 / (accel * 2.0);
+ // + rowSize()/4 to encourage moving at least one item in the flick direction
+ qreal dist = v2 / (accel * 2.0) + rowSize()/4;
if (v > 0)
dist = -dist;
data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart;
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index a20d6bc..425976f 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -386,7 +386,7 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi
void QDeclarativeImage::pixmapChange()
{
updatePaintedGeometry();
- QDeclarativeImageBase::pixmapChange();
+ emit pixmapChanged();
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeimage_p.h b/src/declarative/graphicsitems/qdeclarativeimage_p.h
index 7394774..da6cbd5 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimage_p.h
@@ -79,6 +79,7 @@ public:
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
Q_SIGNALS:
+ void pixmapChanged();
void fillModeChanged();
void paintedGeometryChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 0e9638d..e65c9d1 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -144,19 +144,19 @@ void QDeclarativeImageBase::load()
static int thisRequestProgress = -1;
static int thisRequestFinished = -1;
if (replyDownloadProgress == -1) {
- replyDownloadProgress =
+ replyDownloadProgress =
QDeclarativePixmapReply::staticMetaObject.indexOfSignal("downloadProgress(qint64,qint64)");
- replyFinished =
+ replyFinished =
QDeclarativePixmapReply::staticMetaObject.indexOfSignal("finished()");
- thisRequestProgress =
+ thisRequestProgress =
QDeclarativeImageBase::staticMetaObject.indexOfSlot("requestProgress(qint64,qint64)");
thisRequestFinished =
QDeclarativeImageBase::staticMetaObject.indexOfSlot("requestFinished()");
}
- QMetaObject::connect(reply, replyFinished, this,
+ QMetaObject::connect(reply, replyFinished, this,
thisRequestFinished, Qt::DirectConnection);
- QMetaObject::connect(reply, replyDownloadProgress, this,
+ QMetaObject::connect(reply, replyDownloadProgress, this,
thisRequestProgress, Qt::DirectConnection);
} else {
//### should be unified with requestFinished
@@ -219,7 +219,6 @@ void QDeclarativeImageBase::componentComplete()
void QDeclarativeImageBase::pixmapChange()
{
- emit pixmapChanged();
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
index cfebdca..b215193 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
@@ -75,7 +75,6 @@ Q_SIGNALS:
void sourceChanged(const QUrl &);
void statusChanged(Status);
void progressChanged(qreal progress);
- void pixmapChanged();
void asynchronousChanged();
protected:
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index d54bb70..73fe1e4 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1124,7 +1124,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (FxListItem *item = firstVisibleItem())
maxDistance = qAbs(item->position() + data.move.value());
} else if (data.move.value() < minExtent) {
- maxDistance = qAbs(minExtent - data.move.value() + (overShoot?overShootDistance(velocity, vSize):0));
+ maxDistance = qAbs(minExtent - data.move.value());
}
if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange)
data.flickTarget = minExtent;
@@ -1133,7 +1133,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
if (FxListItem *item = nextVisibleItem())
maxDistance = qAbs(item->position() + data.move.value());
} else if (data.move.value() > maxExtent) {
- maxDistance = qAbs(maxExtent - data.move.value()) + (overShoot?overShootDistance(velocity, vSize):0);
+ maxDistance = qAbs(maxExtent - data.move.value());
}
if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange)
data.flickTarget = maxExtent;
@@ -1156,7 +1156,8 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
qreal v2 = v * v;
qreal maxAccel = v2 / (2.0f * maxDistance);
if (maxAccel < accel) {
- qreal dist = v2 / (accel * 2.0);
+ // + averageSize/4 to encourage moving at least one item in the flick direction
+ qreal dist = v2 / (accel * 2.0) + averageSize/4;
if (v > 0)
dist = -dist;
data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart;
@@ -1166,6 +1167,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
} else {
data.flickTarget = velocity > 0 ? minExtent : maxExtent;
overshootDist = overShoot ? overShootDistance(v, vSize) : 0;
+ qDebug() << "boundary" << overshootDist;
}
timeline.reset(data.move);
timeline.accel(data.move, v, accel, maxDistance + overshootDist);
@@ -1956,10 +1958,11 @@ void QDeclarativeListView::viewportMoved()
if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange && d->highlight) {
// reposition highlight
qreal pos = d->highlight->position();
- if (pos > d->position() + d->highlightRangeEnd - 1 - d->highlight->size())
- pos = d->position() + d->highlightRangeEnd - 1 - d->highlight->size();
- if (pos < d->position() + d->highlightRangeStart)
- pos = d->position() + d->highlightRangeStart;
+ qreal viewPos = qRound(d->position());
+ if (pos > viewPos + d->highlightRangeEnd - 1 - d->highlight->size())
+ pos = viewPos + d->highlightRangeEnd - 1 - d->highlight->size();
+ if (pos < viewPos + d->highlightRangeStart)
+ pos = viewPos + d->highlightRangeStart;
d->highlight->setPosition(pos);
// update current index