aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/imagine
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-03-30 14:58:23 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-03-31 09:58:26 +0200
commit764b21987e36bc0734b7e8c9aab0e0d25771b56e (patch)
tree9d3ecd8d6766d40ecd32d336ba40758953883cfc /src/imports/controls/imagine
parent909248fdf16ecfa012c9ceb50d20da52c4486b43 (diff)
Ninepatch: keep resetNode status to not lose track of ImageNode->NinePatchNode changes
Basically does what 788865b805bc91151ac8fe18bf7b92b1212ee07d did, but on the other branch. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-87236 Change-Id: Ie8371de8a9d49054c888e4bffb7e89392a6d7c07 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports/controls/imagine')
-rw-r--r--src/imports/controls/imagine/impl/qquickninepatchimage.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/imports/controls/imagine/impl/qquickninepatchimage.cpp b/src/imports/controls/imagine/impl/qquickninepatchimage.cpp
index a9da2929..66404ba4 100644
--- a/src/imports/controls/imagine/impl/qquickninepatchimage.cpp
+++ b/src/imports/controls/imagine/impl/qquickninepatchimage.cpp
@@ -386,7 +386,12 @@ void QQuickNinePatchImage::pixmapChange()
{
Q_D(QQuickNinePatchImage);
if (QFileInfo(d->url.fileName()).completeSuffix().toLower() == QLatin1String("9.png")) {
- d->resetNode = d->ninePatch.isNull();
+ // Keep resetNode if it is already set, we do not want to miss an
+ // ImageNode->NinePatchNode change. Without this there's a chance one gets
+ // an incorrect cast on oldNode every once in a while with source changes.
+ if (!d->resetNode)
+ d->resetNode = d->ninePatch.isNull();
+
d->ninePatch = d->pix.image();
if (d->ninePatch.depth() != 32)
d->ninePatch = d->ninePatch.convertToFormat(QImage::Format_ARGB32);