diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-26 09:14:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-26 13:21:16 +0200 |
commit | 75d8ebb3e6925f500ddeefe2ab491be2ae83264c (patch) | |
tree | 6874c91386434f4a1934a9555a3f1d5daf69434c /src | |
parent | fcb40ff6d71f4561401e6b2bd4d7fc706fff8eee (diff) | |
parent | ba8416b80f42c81387170620472194e7a76429b8 (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4engine.cpp
Change-Id: Ie3ef6202b6a3a8521971e1be10c40c6a2db6989c
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 41 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4arrayobject.cpp | 4 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 5 | ||||
-rw-r--r-- | src/qmltest/quicktestresult.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquickgridview.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickitemview.cpp | 14 | ||||
-rw-r--r-- | src/quick/items/qquickitemview_p_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 10 | ||||
-rw-r--r-- | src/quick/items/qquickpathview_p_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktext.cpp | 8 | ||||
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 6 | ||||
-rw-r--r-- | src/quick/items/qquicktextedit_p_p.h | 5 | ||||
-rw-r--r-- | src/quick/items/qquicktextnode.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgatlastexture.cpp | 3 |
18 files changed, 87 insertions, 34 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 673d4e5db0..8488d6eb2b 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -141,13 +141,31 @@ public: if (set.blockNumbers) numberIt = set.blockNumbers->begin(); else - flagIt = std::distance(set.blockFlags->begin(), - std::find(set.blockFlags->begin(), - set.blockFlags->end(), - true)); + findNextWithFlags(0); } } + void findNextWithFlags(size_t start) + { + flagIt = std::distance(set.blockFlags->begin(), + std::find(set.blockFlags->begin() + start, + set.blockFlags->end(), + true)); + + // The ++operator of std::vector<bool>::iterator in libc++ has a bug when using it on an + // iterator pointing to the last element. It will not be set to ::end(), but beyond + // that. (It will be set to the first multiple of the native word size that is bigger + // than size().) + // + // See http://llvm.org/bugs/show_bug.cgi?id=19663 + // + // As we use the size to for our end() iterator, take the minimum of the size and the + // distance for the flagIt: + flagIt = qMin(flagIt, set.blockFlags->size()); + + Q_ASSERT(flagIt <= set.blockFlags->size()); + } + public: BasicBlock *operator*() const { @@ -175,17 +193,10 @@ public: const_iterator &operator++() { - if (set.blockNumbers) { - if (numberIt != set.blockNumbers->end()) - ++numberIt; - } else if (flagIt < set.blockFlags->size()) { - flagIt = std::distance(set.blockFlags->begin(), - std::find(set.blockFlags->begin() + flagIt + 1, - set.blockFlags->end(), - true)); - if (flagIt > set.blockFlags->size()) - flagIt = set.blockFlags->size(); - } + if (set.blockNumbers) + ++numberIt; + else + findNextWithFlags(flagIt + 1); return *this; } diff --git a/src/qml/jsruntime/qv4arrayobject.cpp b/src/qml/jsruntime/qv4arrayobject.cpp index 838c541900..abe8a44065 100644 --- a/src/qml/jsruntime/qv4arrayobject.cpp +++ b/src/qml/jsruntime/qv4arrayobject.cpp @@ -366,7 +366,7 @@ ReturnedValue ArrayPrototype::method_shift(CallContext *ctx) ScopedValue result(scope); - if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len) { + if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len && instance->arrayData()->type() != ArrayData::Custom) { result = instance->arrayData()->vtable()->pop_front(instance.getPointer()); } else { result = instance->getIndexed(0); @@ -545,7 +545,7 @@ ReturnedValue ArrayPrototype::method_unshift(CallContext *ctx) uint len = instance->getLength(); - if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len) { + if (!instance->protoHasArray() && !instance->arrayData()->hasAttributes() && instance->arrayData()->length() <= len && instance->arrayData()->type() != ArrayData::Custom) { instance->arrayData()->vtable()->push_front(instance.getPointer(), ctx->d()->callData->args, ctx->d()->callData->argc); } else { ScopedValue v(scope); diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index f2cfc3efd2..7be518916d 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -851,7 +851,11 @@ void ExecutionEngine::markObjects() ExecutionContext *c = currentContext(); while (c) { - c->mark(this); + Q_ASSERT(c->inUse()); + if (!c->markBit()) { + c->d()->markBit = 1; + c->markObjects(c, this); + } c = c->d()->parent; } diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 40b6a34f07..616f54d174 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -780,6 +780,11 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent) The ownership of the returned object instance is transferred to the caller. + If the object being created from this component is a visual item, it must + have a visual parent, which can be set by calling + QQuickItem::setParentItem(). See \l {Concepts - Visual Parent in Qt Quick} + for more details. + \sa QQmlEngine::ObjectOwnership */ QObject *QQmlComponent::create(QQmlContext *context) diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index ab37be3c95..3329fd72e6 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -685,7 +685,7 @@ void QuickTestResult::stopBenchmark() QObject *QuickTestResult::grabImage(QQuickItem *item) { - if (item) { + if (item && item->window()) { QQuickWindow *window = item->window(); QImage grabbed = window->grabWindow(); QRectF rf(item->x(), item->y(), item->width(), item->height()); diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 45566f2e89..ee71ea8a76 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -327,7 +327,7 @@ bool QQuickFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExt maxDistance = qAbs(maxExtent - data.move.value()); data.flickTarget = maxExtent; } - if (maxDistance > 0) { + if (maxDistance > 0 || boundsBehavior == QQuickFlickable::DragAndOvershootBounds) { qreal v = velocity; if (maxVelocity != -1 && maxVelocity < qAbs(v)) { if (v < 0) @@ -1541,6 +1541,10 @@ void QQuickFlickable::geometryChanged(const QRectF &newGeometry, void QQuickFlickable::flick(qreal xVelocity, qreal yVelocity) { Q_D(QQuickFlickable); + d->hData.reset(); + d->vData.reset(); + d->hData.velocity = xVelocity; + d->vData.velocity = yVelocity; bool flickedX = d->flickX(xVelocity); bool flickedY = d->flickY(yVelocity); d->flickingStarted(flickedX, flickedY); diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index 77ff275619..5b928310cd 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -1616,7 +1616,7 @@ void QQuickGridView::setFlow(Flow flow) } setContentX(0); setContentY(0); - d->regenerate(); + d->regenerate(true); emit flowChanged(); } } diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index ef696dae96..2a686b4342 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -1783,18 +1783,20 @@ void QQuickItemViewPrivate::refill(qreal from, qreal to) emit q->countChanged(); } -void QQuickItemViewPrivate::regenerate() +void QQuickItemViewPrivate::regenerate(bool orientationChanged) { Q_Q(QQuickItemView); if (q->isComponentComplete()) { currentChanges.reset(); - delete header; - header = 0; - delete footer; - footer = 0; + if (orientationChanged) { + delete header; + header = 0; + delete footer; + footer = 0; + } + clear(); updateHeader(); updateFooter(); - clear(); updateViewport(); setPosition(contentStartOffset()); refill(); diff --git a/src/quick/items/qquickitemview_p_p.h b/src/quick/items/qquickitemview_p_p.h index 3f0f3b3646..7c8656cced 100644 --- a/src/quick/items/qquickitemview_p_p.h +++ b/src/quick/items/qquickitemview_p_p.h @@ -184,7 +184,7 @@ public: virtual void clear(); virtual void updateViewport(); - void regenerate(); + void regenerate(bool orientationChanged=false); void layout(); virtual void animationFinished(QAbstractAnimationJob *); void refill(); diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index a1388e3512..e8043804fb 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -2072,7 +2072,7 @@ void QQuickListView::setOrientation(QQuickListView::Orientation orientation) setFlickableDirection(HorizontalFlick); setContentY(0); } - d->regenerate(); + d->regenerate(true); emit orientationChanged(); } } diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index de5ed99640..efce244f7d 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -104,6 +104,7 @@ QQuickPathViewPrivate::QQuickPathViewPrivate() , stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true) , autoHighlight(true), highlightUp(false), layoutScheduled(false) , moving(false), flicking(false), dragging(false), inRequest(false), delegateValidated(false) + , inRefill(false) , dragMargin(0), deceleration(100), maximumFlickVelocity(QML_FLICK_DEFAULTMAXVELOCITY) , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0) , firstIndex(-1), pathItems(-1), requestedIndex(-1), cacheSize(0), requestedZ(0) @@ -1873,11 +1874,18 @@ void QQuickPathView::refill() { Q_D(QQuickPathView); + if (d->inRefill) { + d->scheduleLayout(); + return; + } + d->layoutScheduled = false; if (!d->isValid() || !isComponentComplete()) return; + d->inRefill = true; + bool currentVisible = false; int count = d->pathItems == -1 ? d->modelCount : qMin(d->pathItems, d->modelCount); @@ -2010,6 +2018,8 @@ void QQuickPathView::refill() } while (d->itemCache.count()) d->releaseItem(d->itemCache.takeLast()); + + d->inRefill = false; } void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset) diff --git a/src/quick/items/qquickpathview_p_p.h b/src/quick/items/qquickpathview_p_p.h index 813f472072..e21f3757e6 100644 --- a/src/quick/items/qquickpathview_p_p.h +++ b/src/quick/items/qquickpathview_p_p.h @@ -152,6 +152,7 @@ public: bool requestedOnPath : 1; bool inRequest : 1; bool delegateValidated : 1; + bool inRefill : 1; QElapsedTimer timer; qint64 lastPosTime; QPointF lastPos; diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 7a4027890c..71265689e9 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -711,7 +711,8 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) } bool shouldUseDesignMetrics = renderType != QQuickText::NativeRendering; - + if (!visibleImgTags.isEmpty()) + visibleImgTags.clear(); layout.setCacheEnabled(true); QTextOption textOption = layout.textOption(); if (textOption.alignment() != q->effectiveHAlign() @@ -940,9 +941,10 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) maxHeight = q->heightValid() ? q->height() : FLT_MAX; // If the width of the item has changed and it's possible the result of wrapping, - // eliding, or scaling has changed do another layout. + // eliding, scaling has changed, or the text is not left aligned do another layout. if ((lineWidth < qMin(oldWidth, naturalWidth) || (widthExceeded && lineWidth > oldWidth)) - && (singlelineElide || multilineElide || canWrap || horizontalFit)) { + && (singlelineElide || multilineElide || canWrap || horizontalFit + || q->effectiveHAlign() != QQuickText::AlignLeft)) { widthExceeded = false; heightExceeded = false; continue; diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index b042e30483..fdaef6df8e 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -1777,8 +1777,12 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * d->updateType = QQuickTextEditPrivate::UpdateNone; - if (!oldNode) // If we had any text node references, they were deleted along with the root node + if (!oldNode) { + // If we had any QQuickTextNode node references, they were deleted along with the root node + // But here we must delete the Node structures in textNodeMap + qDeleteAll(d->textNodeMap); d->textNodeMap.clear(); + } RootNode *rootNode = static_cast<RootNode *>(oldNode); TextNodeIterator nodeIterator = d->textNodeMap.begin(); diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index 25681c89f6..0cf7ee2850 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -111,6 +111,11 @@ public: { } + ~QQuickTextEditPrivate() + { + qDeleteAll(textNodeMap); + } + static QQuickTextEditPrivate *get(QQuickTextEdit *item) { return static_cast<QQuickTextEditPrivate *>(QObjectPrivate::get(item)); } diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index da0d9cd714..02e321dfba 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -303,6 +303,8 @@ void QQuickTextNode::deleteContent() while (firstChild() != 0) delete firstChild(); m_cursorNode = 0; + qDeleteAll(m_textures); + m_textures.clear(); } #if 0 diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index a7659e4871..37525e6151 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -3335,7 +3335,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const \warning The returned texture is not memory managed by the scene graph and must be explicitly deleted by the caller on the rendering thread. - This is acheived by deleting the texture from a QSGNode destructor + This is achieved by deleting the texture from a QSGNode destructor or by using deleteLater() in the case where the texture already has affinity to the rendering thread. diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index ceeaa977d7..c92d79dc2a 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -270,6 +270,9 @@ void Atlas::uploadBgra(Texture *texture) const QRect &r = texture->atlasSubRect(); QImage image = texture->image(); + if (image.isNull()) + return; + if (image.format() != QImage::Format_ARGB32_Premultiplied && image.format() != QImage::Format_RGB32) { image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); |