aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Senyk <thomas.senyk@qt.io>2022-12-15 18:01:12 +0100
committerThomas Senyk <thomas.senyk@qt.io>2023-02-01 09:06:16 +0100
commitb899dff5d496e8bebb6bb81e37951d03f8469f63 (patch)
treea67e25b4c52cb3809fe7fb70d19632e1e0aa5d1b /src
parent185b0d5f215df0254b38ac8a7dfb72c20ce9bc1e (diff)
Fix QQuickImageParticle in case of QRhi re-create
With this patch QQuickImageParticle will now properly re-query the m_rhi member the next time updatePaintNode() is called Additionally a new (override) QQuickImageParticle::invalidateSceneGraph() will call reset() so that potential sub-nodes (e.g. SpriteParticle) will also be re-created Last but not least: QQuickSpriteEngine::startAssemblingImage() was missing to reset it's sprites container (without that the sprites would pile up and eventually fail with "Too many animations" error) Pick-to: 6.5 6.4 6.2 Change-Id: I172fd23ddfac475542aabc6cc17d8fee74f728b2 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/particles/qquickimageparticle.cpp7
-rw-r--r--src/particles/qquickimageparticle_p.h2
-rw-r--r--src/quick/items/qquickspriteengine.cpp1
3 files changed, 10 insertions, 0 deletions
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 9730fd1960..07076c6d29 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -730,6 +730,7 @@ void QQuickImageParticle::sceneGraphInvalidated()
m_material = nullptr;
delete m_outgoingNode;
m_outgoingNode = nullptr;
+ m_apiChecked = false;
}
void QQuickImageParticle::setImage(const QUrl &image)
@@ -1038,6 +1039,12 @@ void QQuickImageParticle::reset()
update();
}
+
+void QQuickImageParticle::invalidateSceneGraph()
+{
+ reset();
+}
+
void QQuickImageParticle::createEngine()
{
if (m_spriteEngine)
diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h
index e92e341718..ecf463ba13 100644
--- a/src/particles/qquickimageparticle_p.h
+++ b/src/particles/qquickimageparticle_p.h
@@ -359,6 +359,8 @@ private Q_SLOTS:
void spritesUpdate(qreal time = 0 );
void mainThreadFetchImageData();
void finishBuildParticleNodes(QSGNode **n);
+ void invalidateSceneGraph();
+
private:
struct ImageData {
QUrl source;
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index fe3cb1f247..5d33092e6d 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -316,6 +316,7 @@ void QQuickSpriteEngine::startAssemblingImage()
return;
m_loaded = false;
m_errorsPrinted = false;
+ m_sprites.clear();
//This could also trigger the start of the image loading in Sprites, however that currently happens in Sprite::setSource