diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-15 01:00:05 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-10-15 01:00:06 +0200 |
commit | b08809b521591bd17955846fbeee651200983f3b (patch) | |
tree | 9cb30ead810e433b35e4a831325ba8f6e709bce3 /src | |
parent | 8d560d1bf0a747bf62f73fad6b6774095442d9d2 (diff) | |
parent | 6e03533f9432eb1695e3c3bbe65667974b5415b4 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I7759f6b60f8fda6525b239c7ee2e034194d4ab85
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/testlib/TestCase.qml | 2 | ||||
-rw-r--r-- | src/particles/qquickimageparticle.cpp | 18 | ||||
-rw-r--r-- | src/particles/qquickimageparticle_p.h | 1 | ||||
-rw-r--r-- | src/quick/items/qquicktextedit.cpp | 9 | ||||
-rw-r--r-- | src/quick/items/qquicktextinput.cpp | 4 |
5 files changed, 24 insertions, 10 deletions
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index e7669fd03d..6e075d8792 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -1631,7 +1631,7 @@ Item { TestCase { name: "ItemTests" - when: area.pressed + when: windowShown id: test1 function test_touch() { diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index bd3865f42f..4ce8186c7c 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -1104,6 +1104,7 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) QQuickImageParticle::QQuickImageParticle(QQuickItem* parent) : QQuickParticlePainter(parent) , m_color_variation(0.0) + , m_outgoingNode(nullptr) , m_material(nullptr) , m_alphaVariation(0.0) , m_alpha(1.0) @@ -1149,6 +1150,8 @@ void QQuickImageParticle::sceneGraphInvalidated() { m_nodes.clear(); m_material = nullptr; + delete m_outgoingNode; + m_outgoingNode = nullptr; } void QQuickImageParticle::setImage(const QUrl &image) @@ -1931,8 +1934,11 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData } if (m_pleaseReset){ - if (node) - delete node; + // Cannot just destroy the node and then return null (in case image + // loading is still in progress). Rather, keep track of the old node + // until we have a new one. + delete m_outgoingNode; + m_outgoingNode = node; node = nullptr; m_lastLevel = perfLevel; @@ -1946,6 +1952,9 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData m_pleaseReset = false; m_startedImageLoading = 0;//Cancel a part-way build (may still have a pending load) + } else if (!m_material) { + delete node; + node = nullptr; } if (m_system && m_system->isRunning() && !m_system->isPaused()){ @@ -1959,6 +1968,11 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData } } + if (!node) { + node = m_outgoingNode; + m_outgoingNode = nullptr; + } + return node; } diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h index 059cf67019..45eb73b86c 100644 --- a/src/particles/qquickimageparticle_p.h +++ b/src/particles/qquickimageparticle_p.h @@ -389,6 +389,7 @@ private: QColor m_color; qreal m_color_variation; + QSGNode *m_outgoingNode; QHash<int, QSGGeometryNode *> m_nodes; QHash<int, int> m_idxStarts;//TODO: Proper resizing will lead to needing a spriteEngine per particle - do this after sprite engine gains transparent sharing? QList<QPair<int, int> > m_startsIdx;//Same data, optimized for alternate retrieval diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index c4e9c0d316..7d34cc3f56 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -2060,20 +2060,19 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * firstDirtyPos = nodeIterator->startPos(); // ### this could be optimized if the first and last dirty nodes are not connected // as the intermediate text nodes would usually only need to be transformed differently. - int lastDirtyPos = firstDirtyPos; + QQuickTextNode *firstCleanNode = nullptr; auto it = d->textNodeMap.constEnd(); while (it != nodeIterator) { --it; - if (it->dirty()) { - lastDirtyPos = it->startPos(); + if (it->dirty()) break; - } + firstCleanNode = it->textNode(); } do { rootNode->removeChildNode(nodeIterator->textNode()); delete nodeIterator->textNode(); nodeIterator = d->textNodeMap.erase(nodeIterator); - } while (nodeIterator != d->textNodeMap.constEnd() && nodeIterator->startPos() <= lastDirtyPos); + } while (nodeIterator != d->textNodeMap.constEnd() && nodeIterator->textNode() != firstCleanNode); } // FIXME: the text decorations could probably be handled separately (only updated for affected textFrames) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 34105d8c81..a83b9beaa5 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -2259,8 +2259,8 @@ void QQuickTextInput::remove(int start, int end) d->m_cursor -= qMin(d->m_cursor, end) - start; if (d->m_selstart > start) d->m_selstart -= qMin(d->m_selstart, end) - start; - if (d->m_selend > end) - d->m_selend -= qMin(d->m_selend, end) - start; + if (d->m_selend >= end) + d->m_selend -= end - start; } d->addCommand(QQuickTextInputPrivate::Command( QQuickTextInputPrivate::SetSelection, d->m_cursor, 0, d->m_selstart, d->m_selend)); |