diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-31 08:48:18 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-31 08:48:18 (GMT) |
commit | e28f10e0d8dfc7d34ead2725eac8ed852b61f070 (patch) | |
tree | e6800421202ca46580911c9ffc92e8722c9e83c9 /src/declarative | |
parent | edd41ee5488716cf8336a7d8ea0cb3d48d0e7b14 (diff) | |
parent | b6a0595e6479138b9d58c499f4285b357e81b2eb (diff) | |
download | Qt-e28f10e0d8dfc7d34ead2725eac8ed852b61f070.zip Qt-e28f10e0d8dfc7d34ead2725eac8ed852b61f070.tar.gz Qt-e28f10e0d8dfc7d34ead2725eac8ed852b61f070.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
QGraphicsEffect : Don't rely on the exposedArea when rendering the item into the cache.
Fix snapping in listview.
Minor cleanup.
Improve flipable example.
Minor cleanup for visual test framework.
VisibleArea is not a creatable type.
More testing.
Test openUrlExternally
doc
example of WebView onAlert, and of popups in general.
Update examples/declarative.pro
Update mouseX(Y) when clicking on a mouse area
Declarative examples cleanup.
Add test.
doc
Move gitignore to right level, update for Linux.
Cleanup MouseArea visual tests.
See if we can get the visual tests working on qws.
Diffstat (limited to 'src/declarative')
6 files changed, 42 insertions, 17 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index e670d3e..ccefc70 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -75,7 +75,7 @@ public: Here is a Flipable that flips whenever it is clicked: - \snippet examples/declarative/flipable/flipable-example.qml 0 + \snippet doc/src/snippets/declarative/flipable.qml 0 \image flipable.gif diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 12ede34..30f04f6 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -815,7 +815,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m if (snapMode != QDeclarativeGridView::SnapToRow && highlightRange != QDeclarativeGridView::StrictlyEnforceRange) data.flickTarget = maxExtent; } - if ((maxDistance > 0 || overShoot) && (snapMode != QDeclarativeGridView::NoSnap || highlightRange == QDeclarativeGridView::StrictlyEnforceRange)) { + if (maxDistance > 0 || overShoot) { // This mode requires the grid to stop exactly on a row boundary. qreal v = velocity; if (maxVelocity != -1 && maxVelocity < qAbs(v)) { @@ -1856,6 +1856,8 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) if (d->currentItem) d->currentItem->index = d->currentIndex; emit currentIndexChanged(); + } else if (d->currentIndex < 0) { + d->updateCurrent(0); } emit countChanged(); return; diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 23a2350..3145c43 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -275,6 +275,10 @@ qreal QDeclarativeImage::paintedHeight() const used by a loaded image. The image will be scaled down if its intrinsic size is greater than this value. + If only one dimension of the size is set (and the other left at 0), the + unset dimension will be set in proportion to the set dimension to preserve + the source image aspect ratio. The fillMode is independent of this. + Unlike setting the width and height properties, which merely scale the painting of the image, this property affects the number of pixels stored. diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 7bc74ce..97a22cf 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -130,7 +130,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeTextEdit>("Qt",4,6,"TextEdit"); qmlRegisterType<QDeclarativeTextInput>("Qt",4,6,"TextInput"); qmlRegisterType<QDeclarativeViewSection>("Qt",4,6,"ViewSection"); - qmlRegisterType<QDeclarativeFlickableVisibleArea>("Qt",4,6,"VisibleArea"); qmlRegisterType<QDeclarativeVisualDataModel>("Qt",4,6,"VisualDataModel"); qmlRegisterType<QDeclarativeVisualItemModel>("Qt",4,6,"VisualItemModel"); @@ -148,6 +147,7 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeVisualModel>(); qmlRegisterType<QAction>(); qmlRegisterType<QDeclarativePen>(); + qmlRegisterType<QDeclarativeFlickableVisibleArea>(); #ifdef QT_WEBKIT_LIB qmlRegisterType<QDeclarativeWebSettings>(); #endif diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index cbf8eac..308612f 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -305,7 +305,7 @@ public: if (item->index == -1) continue; qreal itemTop = item->position(); - if (item->index == model->count()-1 || (itemTop+item->size()/2 >= pos)) + if (itemTop+item->size()/2 >= pos && itemTop <= pos) return item->position(); } if (visibleItems.count()) { @@ -1153,7 +1153,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m maxDistance = qAbs(minExtent - data.move.value()); } } - if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) + if (snapMode == QDeclarativeListView::NoSnap && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = minExtent; } else { if (data.move.value() > maxExtent) { @@ -1164,10 +1164,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m maxDistance = qAbs(maxExtent - data.move.value()); } } - if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) + if (snapMode == QDeclarativeListView::NoSnap && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = maxExtent; } - if ((maxDistance > 0 || overShoot) && (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)) { + if (maxDistance > 0 || overShoot) { // These modes require the list to stop exactly on an item boundary. // The initial flick will estimate the boundary to stop on. // Since list items can have variable sizes, the boundary will be @@ -1183,18 +1183,35 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m // the initial flick - estimate boundary qreal accel = deceleration; qreal v2 = v * v; - if (maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) { - // + 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; + overshootDist = 0.0; + // + averageSize/4 to encourage moving at least one item in the flick direction + qreal dist = v2 / (accel * 2.0) + averageSize/4; + if (maxDistance > 0) + dist = qMin(dist, maxDistance); + if (v > 0) + dist = -dist; + if ((maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) || snapMode == QDeclarativeListView::SnapOneItem) { data.flickTarget = -snapPosAt(-(data.move.value() - highlightRangeStart) + dist) + highlightRangeStart; + if (overShoot) { + if (data.flickTarget >= minExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget += overshootDist; + } else if (data.flickTarget <= maxExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget -= overshootDist; + } + } dist = -data.flickTarget + data.move.value(); accel = v2 / (2.0f * qAbs(dist)); - overshootDist = 0.0; - } else { - data.flickTarget = velocity > 0 ? minExtent : maxExtent; - overshootDist = overShoot ? overShootDistance(v, vSize) : 0; + } else if (overShoot) { + data.flickTarget = data.move.value() - dist; + if (data.flickTarget >= minExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget += overshootDist; + } else if (data.flickTarget <= maxExtent) { + overshootDist = overShootDistance(v, vSize); + data.flickTarget -= overshootDist; + } } timeline.reset(data.move); timeline.accel(data.move, v, accel, maxDistance + overshootDist); @@ -2381,6 +2398,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) if (d->currentItem) d->currentItem->index = d->currentIndex; emit currentIndexChanged(); + } else if (d->currentIndex < 0) { + d->updateCurrent(0); } emit countChanged(); return; @@ -2743,7 +2762,6 @@ void QDeclarativeListView::destroyingItem(QDeclarativeItem *item) void QDeclarativeListView::animStopped() { Q_D(QDeclarativeListView); - d->moveReason = QDeclarativeListViewPrivate::Other; d->bufferMode = QDeclarativeListViewPrivate::NoBuffer; } diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index dde3366..6126a6f 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -640,6 +640,7 @@ bool QDeclarativeMouseArea::setPressed(bool p) QDeclarativeMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, isclick, d->longPress); if (d->pressed) { emit pressed(&me); + emit positionChanged(&me); } else { emit released(&me); if (isclick) |