diff options
author | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2010-03-25 07:42:21 (GMT) |
---|---|---|
committer | Morten Johan Sørvig <morten.sorvig@nokia.com> | 2010-03-25 07:42:21 (GMT) |
commit | 20779098f4eb73f8789d704e1a2818ddbbf5b4d2 (patch) | |
tree | b1c4e3edb447ee47f9bc724f106d1bbefcff5456 /src/declarative/graphicsitems | |
parent | 8cc346604ed1e1504964772613ed9fe531361f69 (diff) | |
parent | 194013d9db1b3e4ba6f56a864f3b64f523202948 (diff) | |
download | Qt-20779098f4eb73f8789d704e1a2818ddbbf5b4d2.zip Qt-20779098f4eb73f8789d704e1a2818ddbbf5b4d2.tar.gz Qt-20779098f4eb73f8789d704e1a2818ddbbf5b4d2.tar.bz2 |
Merge remote branch 'main/4.7' into 4.7
Conflicts:
demos/declarative/minehunt/minehunt.cpp
src/declarative/qml/qdeclarativecompiler.cpp
Diffstat (limited to 'src/declarative/graphicsitems')
12 files changed, 139 insertions, 101 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeflipable.cpp b/src/declarative/graphicsitems/qdeclarativeflipable.cpp index d19e5a5..1fa08bb 100644 --- a/src/declarative/graphicsitems/qdeclarativeflipable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflipable.cpp @@ -42,6 +42,7 @@ #include "qdeclarativeflipable_p.h" #include "qdeclarativeitem_p.h" +#include "qdeclarativeguard_p.h" #include <qdeclarativeinfo.h> @@ -58,8 +59,8 @@ public: void updateSceneTransformFromParent(); QDeclarativeFlipable::Side current; - QDeclarativeItem *front; - QDeclarativeItem *back; + QDeclarativeGuard<QDeclarativeItem> front; + QDeclarativeGuard<QDeclarativeItem> back; }; /*! @@ -159,7 +160,7 @@ QDeclarativeFlipable::Side QDeclarativeFlipable::side() const { Q_D(const QDeclarativeFlipable); if (d->dirtySceneTransform) - const_cast<QDeclarativeFlipablePrivate *>(d)->updateSceneTransformFromParent(); + const_cast<QDeclarativeFlipablePrivate *>(d)->ensureSceneTransform(); return d->current; } @@ -192,7 +193,7 @@ void QDeclarativeFlipablePrivate::updateSceneTransformFromParent() if (newSide != current) { current = newSide; - if (current == QDeclarativeFlipable::Back) { + if (current == QDeclarativeFlipable::Back && back) { QTransform mat; mat.translate(back->width()/2,back->height()/2); if (back->width() && p1.x() >= p2.x()) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 93f8d06..de0cb04 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -786,28 +786,32 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m QDeclarativeFlickablePrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity); return; } - qreal maxDistance = -1; + qreal maxDistance = 0; // -ve velocity means list is moving up if (velocity > 0) { - if (snapMode == QDeclarativeGridView::SnapOneRow) { - if (FxGridItem *item = firstVisibleItem()) - maxDistance = qAbs(item->rowPos() + data.move.value()); - } else if (data.move.value() < minExtent) { - maxDistance = qAbs(minExtent - data.move.value()); + if (data.move.value() < minExtent) { + if (snapMode == QDeclarativeGridView::SnapOneRow) { + if (FxGridItem *item = firstVisibleItem()) + maxDistance = qAbs(item->rowPos() + data.move.value()); + } else { + maxDistance = qAbs(minExtent - data.move.value()); + } } if (snapMode != QDeclarativeGridView::SnapToRow && highlightRange != QDeclarativeGridView::StrictlyEnforceRange) data.flickTarget = minExtent; } else { - if (snapMode == QDeclarativeGridView::SnapOneRow) { - 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()); + if (data.move.value() > maxExtent) { + if (snapMode == QDeclarativeGridView::SnapOneRow) { + qreal pos = snapPosAt(-data.move.value()) + rowSize(); + maxDistance = qAbs(pos + data.move.value()); + } else { + maxDistance = qAbs(maxExtent - data.move.value()); + } } if (snapMode != QDeclarativeGridView::SnapToRow && highlightRange != QDeclarativeGridView::StrictlyEnforceRange) data.flickTarget = maxExtent; } - if (maxDistance > 0 && (snapMode != QDeclarativeGridView::NoSnap || highlightRange == QDeclarativeGridView::StrictlyEnforceRange)) { + if ((maxDistance > 0 || overShoot) && (snapMode != QDeclarativeGridView::NoSnap || highlightRange == QDeclarativeGridView::StrictlyEnforceRange)) { // This mode requires the grid to stop exactly on a row boundary. qreal v = velocity; if (maxVelocity != -1 && maxVelocity < qAbs(v)) { @@ -818,9 +822,8 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m } qreal accel = deceleration; qreal v2 = v * v; - qreal maxAccel = v2 / (2.0f * maxDistance); qreal overshootDist = 0.0; - if (maxAccel < accel) { + if (maxDistance > 0.0 && v2 / (2.0f * maxDistance) < accel) { // + rowSize()/4 to encourage moving at least one item in the flick direction qreal dist = v2 / (accel * 2.0) + rowSize()/4; if (v > 0) @@ -924,7 +927,7 @@ QDeclarativeGridView::~QDeclarativeGridView() id: wrapper SequentialAnimation on GridView.onRemove { PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: true } - NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: false } } } @@ -1080,8 +1083,9 @@ void QDeclarativeGridView::setCurrentIndex(int index) d->moveReason = QDeclarativeGridViewPrivate::SetIndex; cancelFlick(); d->updateCurrent(index); - } else { + } else if (index != d->currentIndex) { d->currentIndex = index; + emit currentIndexChanged(); } } @@ -1504,10 +1508,12 @@ qreal QDeclarativeGridView::maxYExtent() const if (d->flow == QDeclarativeGridView::TopToBottom) return QDeclarativeFlickable::maxYExtent(); qreal extent; - if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) + if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { extent = -(d->endPosition() - d->highlightRangeEnd); - else + extent = qMax(extent, -(d->rowPosAt(d->model->count()-1) - d->highlightRangeStart)); + } else { extent = -(d->endPosition() - height()); + } const qreal minY = minYExtent(); if (extent > minY) extent = minY; @@ -1531,10 +1537,12 @@ qreal QDeclarativeGridView::maxXExtent() const if (d->flow == QDeclarativeGridView::LeftToRight) return QDeclarativeFlickable::maxXExtent(); qreal extent; - if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) + if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { extent = -(d->endPosition() - d->highlightRangeEnd); - else + extent = qMax(extent, -(d->rowPosAt(d->model->count()-1) - d->highlightRangeStart)); + } else { extent = -(d->endPosition() - height()); + } const qreal minX = minXExtent(); if (extent > minX) extent = minX; @@ -1838,9 +1846,17 @@ void QDeclarativeGridView::trackedPositionChanged() void QDeclarativeGridView::itemsInserted(int modelIndex, int count) { Q_D(QDeclarativeGridView); + if (!isComponentComplete()) + return; if (!d->visibleItems.count() || d->model->count() <= 1) { d->scheduleLayout(); - d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1))); + if (d->currentIndex >= modelIndex) { + // adjust current item index + d->currentIndex += count; + if (d->currentItem) + d->currentItem->index = d->currentIndex; + emit currentIndexChanged(); + } emit countChanged(); return; } @@ -1964,6 +1980,8 @@ void QDeclarativeGridView::itemsInserted(int modelIndex, int count) void QDeclarativeGridView::itemsRemoved(int modelIndex, int count) { Q_D(QDeclarativeGridView); + if (!isComponentComplete()) + return; bool currentRemoved = d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count; bool removedVisible = false; @@ -2054,6 +2072,8 @@ void QDeclarativeGridView::destroyRemoved() void QDeclarativeGridView::itemsMoved(int from, int to, int count) { Q_D(QDeclarativeGridView); + if (!isComponentComplete()) + return; QHash<int,FxGridItem*> moved; bool removedBeforeVisible = false; diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 0bc4b8b..ccad8f1 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -45,7 +45,6 @@ #include "qdeclarativeevents_p_p.h" #include <private/qdeclarativeengine_p.h> -#include <qfxperf_p_p.h> #include <qdeclarativeengine.h> #include <qdeclarativeopenmetaobject_p.h> #include <qdeclarativestate_p.h> @@ -2491,10 +2490,6 @@ void QDeclarativeItem::classBegin() */ void QDeclarativeItem::componentComplete() { -#ifdef Q_ENABLE_PERFORMANCE_LOG - QDeclarativePerfTimer<QDeclarativePerf::ItemComponentComplete> cc; -#endif - Q_D(QDeclarativeItem); d->_componentComplete = true; if (d->_stateGroup) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 84281c8..320a2f0 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1136,28 +1136,32 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m QDeclarativeFlickablePrivate::flick(data, minExtent, maxExtent, vSize, fixupCallback, velocity); return; } - qreal maxDistance = -1; - // -ve velocity means list is moving up + qreal maxDistance = 0; + // -ve velocity means list is moving up/left if (velocity > 0) { - if (snapMode == QDeclarativeListView::SnapOneItem) { - if (FxListItem *item = firstVisibleItem()) - maxDistance = qAbs(item->position() + data.move.value()); - } else if (data.move.value() < minExtent) { - maxDistance = qAbs(minExtent - data.move.value()); + if (data.move.value() < minExtent) { + if (snapMode == QDeclarativeListView::SnapOneItem) { + if (FxListItem *item = firstVisibleItem()) + maxDistance = qAbs(item->position() + data.move.value()); + } else { + maxDistance = qAbs(minExtent - data.move.value()); + } } if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = minExtent; } else { - if (snapMode == QDeclarativeListView::SnapOneItem) { - if (FxListItem *item = nextVisibleItem()) - maxDistance = qAbs(item->position() + data.move.value()); - } else if (data.move.value() > maxExtent) { - maxDistance = qAbs(maxExtent - data.move.value()); + if (data.move.value() > maxExtent) { + if (snapMode == QDeclarativeListView::SnapOneItem) { + if (FxListItem *item = nextVisibleItem()) + maxDistance = qAbs(item->position() + data.move.value()); + } else { + maxDistance = qAbs(maxExtent - data.move.value()); + } } if (snapMode != QDeclarativeListView::SnapToItem && highlightRange != QDeclarativeListView::StrictlyEnforceRange) data.flickTarget = maxExtent; } - if (maxDistance > 0 && (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)) { + if ((maxDistance > 0 || overShoot) && (snapMode != QDeclarativeListView::NoSnap || highlightRange == QDeclarativeListView::StrictlyEnforceRange)) { // 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 @@ -1173,8 +1177,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m // the initial flick - estimate boundary qreal accel = deceleration; qreal v2 = v * v; - qreal maxAccel = v2 / (2.0f * maxDistance); - if (maxAccel < accel) { + 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) @@ -1328,7 +1331,7 @@ QDeclarativeListView::~QDeclarativeListView() id: wrapper SequentialAnimation on ListView.onRemove { PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: true } - NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: false } } } @@ -1488,8 +1491,9 @@ void QDeclarativeListView::setCurrentIndex(int index) d->moveReason = QDeclarativeListViewPrivate::SetIndex; cancelFlick(); d->updateCurrent(index); - } else { + } else if (index != d->currentIndex) { d->currentIndex = index; + emit currentIndexChanged(); } } @@ -2063,9 +2067,10 @@ qreal QDeclarativeListView::maxYExtent() const if (d->orient == QDeclarativeListView::Horizontal) return height(); if (d->maxExtentDirty) { - if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) + if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { d->maxExtent = -(d->endPosition() - d->highlightRangeEnd); - else + d->maxExtent = qMax(d->maxExtent, -(d->positionAt(d->model->count()-1) - d->highlightRangeStart)); + } else d->maxExtent = -(d->endPosition() - height() + 1); if (d->footer) d->maxExtent -= d->footer->size(); @@ -2100,9 +2105,10 @@ qreal QDeclarativeListView::maxXExtent() const if (d->orient == QDeclarativeListView::Vertical) return width(); if (d->maxExtentDirty) { - if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) + if (d->haveHighlightRange && d->highlightRange == StrictlyEnforceRange) { d->maxExtent = -(d->endPosition() - d->highlightRangeEnd); - else + d->maxExtent = qMax(d->maxExtent, -(d->positionAt(d->model->count()-1) - d->highlightRangeStart)); + } else d->maxExtent = -(d->endPosition() - width() + 1); if (d->footer) d->maxExtent -= d->footer->size(); @@ -2361,11 +2367,19 @@ void QDeclarativeListView::trackedPositionChanged() void QDeclarativeListView::itemsInserted(int modelIndex, int count) { Q_D(QDeclarativeListView); + if (!isComponentComplete()) + return; d->updateUnrequestedIndexes(); d->moveReason = QDeclarativeListViewPrivate::Other; if (!d->visibleItems.count() || d->model->count() <= 1) { d->scheduleLayout(); - d->updateCurrent(qMax(0, qMin(d->currentIndex, d->model->count()-1))); + if (d->currentIndex >= modelIndex) { + // adjust current item index + d->currentIndex += count; + if (d->currentItem) + d->currentItem->index = d->currentIndex; + emit currentIndexChanged(); + } emit countChanged(); return; } @@ -2495,6 +2509,8 @@ void QDeclarativeListView::itemsInserted(int modelIndex, int count) void QDeclarativeListView::itemsRemoved(int modelIndex, int count) { Q_D(QDeclarativeListView); + if (!isComponentComplete()) + return; d->moveReason = QDeclarativeListViewPrivate::Other; d->updateUnrequestedIndexes(); @@ -2593,6 +2609,8 @@ void QDeclarativeListView::destroyRemoved() void QDeclarativeListView::itemsMoved(int from, int to, int count) { Q_D(QDeclarativeListView); + if (!isComponentComplete()) + return; d->updateUnrequestedIndexes(); if (d->visibleItems.isEmpty()) { diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 6dbcd16..0d62afa 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -41,7 +41,9 @@ #include "qdeclarativeloader_p_p.h" +#include <qdeclarativeinfo.h> #include <qdeclarativeengine_p.h> +#include <qdeclarativeglobal_p.h> QT_BEGIN_NAMESPACE @@ -66,7 +68,7 @@ void QDeclarativeLoaderPrivate::itemGeometryChanged(QDeclarativeItem *resizeItem void QDeclarativeLoaderPrivate::clear() { if (ownComponent) { - delete component; + component->deleteLater(); component = 0; ownComponent = false; } @@ -285,11 +287,20 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() return; } + QDeclarativeComponent *c = component; QObject *obj = component->create(ctxt); + if (component != c) { + // component->create could trigger a change in source that causes + // component to be set to something else. In that case we just + // need to cleanup. + delete obj; + delete ctxt; + return; + } if (obj) { - ctxt->setParent(obj); item = qobject_cast<QGraphicsObject *>(obj); if (item) { + QDeclarative_setParent_noEvent(ctxt, obj); if (QDeclarativeItem* qmlItem = qobject_cast<QDeclarativeItem *>(item)) { qmlItem->setParentItem(q); } else { @@ -298,8 +309,14 @@ void QDeclarativeLoaderPrivate::_q_sourceLoaded() } // item->setFocus(true); initResize(); + } else { + qmlInfo(q) << QDeclarativeLoader::tr("Loader does not support loading non-visual elements."); + delete obj; + delete ctxt; } } else { + if (!component->errors().isEmpty()) + qWarning() << component->errors(); delete obj; delete ctxt; source = QUrl(); diff --git a/src/declarative/graphicsitems/qdeclarativepath.cpp b/src/declarative/graphicsitems/qdeclarativepath.cpp index 80586b8..8cd990fc 100644 --- a/src/declarative/graphicsitems/qdeclarativepath.cpp +++ b/src/declarative/graphicsitems/qdeclarativepath.cpp @@ -42,9 +42,8 @@ #include "qdeclarativepath_p.h" #include "qdeclarativepath_p_p.h" -#include <qfxperf_p_p.h> - #include <QSet> +#include <QTime> #include <private/qbezier_p.h> @@ -314,7 +313,6 @@ QStringList QDeclarativePath::attributes() const Q_D(const QDeclarativePath); return d->_attributes; } -#include <QTime> static inline QBezier nextBezier(const QPainterPath &path, int *from, qreal *bezLength) { @@ -356,9 +354,6 @@ static inline QBezier nextBezier(const QPainterPath &path, int *from, qreal *bez void QDeclarativePath::createPointCache() const { Q_D(const QDeclarativePath); -#ifdef Q_ENABLE_PERFORMANCE_LOG - QDeclarativePerfTimer<QDeclarativePerf::QDeclarativePathViewPathCache> pc; -#endif qreal pathLength = d->_path.length(); const int points = int(pathLength*2); const int lastElement = d->_path.elementCount() - 1; diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index 0f59a70..7a0d33a 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -46,7 +46,6 @@ #include <qdeclarativestate_p.h> #include <qdeclarativestategroup_p.h> #include <qdeclarativestateoperations_p.h> -#include <qfxperf_p_p.h> #include <QtCore/qmath.h> #include <QDebug> @@ -164,9 +163,6 @@ void QDeclarativeBasePositioner::componentComplete() { Q_D(QDeclarativeBasePositioner); QDeclarativeItem::componentComplete(); -#ifdef Q_ENABLE_PERFORMANCE_LOG - QDeclarativePerfTimer<QDeclarativePerf::BasepositionerComponentComplete> cc; -#endif positionedItems.reserve(d->QGraphicsItemPrivate::children.count()); prePositioning(); } @@ -225,20 +221,21 @@ void QDeclarativeBasePositioner::prePositioning() d->watchChanges(child); positionedItems.append(posItem); item = &positionedItems[positionedItems.count()-1]; + item->isNew = true; + if (child->opacity() <= 0.0 || !child->isVisible()) + item->isVisible = false; } else { item = &oldItems[wIdx]; + if (child->opacity() <= 0.0 || !child->isVisible()) { + item->isVisible = false; + } else if (!item->isVisible) { + item->isVisible = true; + item->isNew = true; + } else { + item->isNew = false; + } positionedItems.append(*item); } - if (child->opacity() <= 0.0 || !child->isVisible()) { - item->isVisible = false; - continue; - } - if (!item->isVisible) { - item->isVisible = true; - item->isNew = true; - } else { - item->isNew = false; - } } doPositioning(); if(d->addTransition || d->moveTransition) @@ -261,11 +258,14 @@ void QDeclarativeBasePositioner::positionX(int x, const PositionedItem &target) { Q_D(QDeclarativeBasePositioner); if(d->type == Horizontal || d->type == Both){ - if(!d->addTransition && !d->moveTransition){ - target.item->setX(x); - }else{ - if(target.isNew) + if (target.isNew) { + if (!d->addTransition) + target.item->setX(x); + else d->addActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x)); + } else if (x != target.item->x()) { + if (!d->moveTransition) + target.item->setX(x); else d->moveActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x)); } @@ -276,11 +276,14 @@ void QDeclarativeBasePositioner::positionY(int y, const PositionedItem &target) { Q_D(QDeclarativeBasePositioner); if(d->type == Vertical || d->type == Both){ - if(!d->addTransition && !d->moveTransition){ - target.item->setY(y); - }else{ - if(target.isNew) + if (target.isNew) { + if (!d->addTransition) + target.item->setY(y); + else d->addActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y)); + } else if (y != target.item->y()) { + if (!d->moveTransition) + target.item->setY(y); else d->moveActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y)); } @@ -382,7 +385,7 @@ Column { move: Transition { NumberAnimation { properties: "y" - easing: "easeOutBounce" + easing.type: "OutBounce" } } } diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index b9696c8..e8f9b24 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -358,14 +358,10 @@ void QDeclarativeRepeater::itemsMoved(int from, int to, int count) removed << d->deletables.takeAt(from); for (int i = 0; i < count; ++i) d->deletables.insert(to + i, removed.at(i)); - for (int i = 0; i < d->model->count(); ++i) { - if (i < from && i < to) - continue; - QDeclarativeItem *item = d->deletables.at(i); - if (i < d->deletables.count()-1) - item->stackBefore(d->deletables.at(i+1)); - else - item->stackBefore(this); + d->deletables.last()->stackBefore(this); + for (int i = d->model->count()-1; i > 0; --i) { + QDeclarativeItem *item = d->deletables.at(i-1); + item->stackBefore(d->deletables.at(i)); } } diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 05139f6..b0b5f6d 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -43,8 +43,6 @@ #include "qdeclarativetext_p_p.h" #include <qdeclarativestyledtext_p.h> -#include <qfxperf_p_p.h> - #include <QTextLayout> #include <QTextLine> #include <QTextDocument> @@ -152,9 +150,6 @@ void QDeclarativeText::setFont(const QFont &font) void QDeclarativeText::setText(const QString &n) { -#ifdef Q_ENABLE_PERFORMANCE_LOG - QDeclarativePerfTimer<QDeclarativePerf::QDeclarativeText_setText> st; -#endif Q_D(QDeclarativeText); if (d->text == n) return; @@ -876,9 +871,6 @@ void QDeclarativeText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWid void QDeclarativeText::componentComplete() { Q_D(QDeclarativeText); -#ifdef Q_ENABLE_PERFORMANCE_LOG - QDeclarativePerfTimer<QDeclarativePerf::TextComponentComplete> cc; -#endif QDeclarativeItem::componentComplete(); if (d->dirty) { d->updateLayout(); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index dbae47d..7dacfbb 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -44,8 +44,6 @@ #include "qdeclarativeevents_p_p.h" -#include <qfxperf_p_p.h> - #include <QTextLayout> #include <QTextLine> #include <QTextDocument> diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 01167dc..b049728 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -220,6 +220,7 @@ void QDeclarativeTextInput::setHAlign(HAlignment align) if(align == d->hAlign) return; d->hAlign = align; + updateRect(); emit horizontalAlignmentChanged(d->hAlign); } diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 6341764..b31bbd0 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -422,6 +422,8 @@ int QDeclarativeVisualDataModelDataMetaObject::createProperty(const char *name, return -1; QDeclarativeVisualDataModelPrivate *model = QDeclarativeVisualDataModelPrivate::get(data->m_model); + if (data->m_index < 0 || data->m_index >= model->modelCount()) + return -1; if ((!model->m_listModelInterface || !model->m_abstractItemModel) && model->m_listAccessor) { if (model->m_listAccessor->type() == QDeclarativeListAccessor::ListProperty) { |