aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-03-30 14:58:23 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-31 09:00:22 +0000
commit386ff4f6aa9fd1ed4e05b405cf31f75be2703ec4 (patch)
treef625bef6c4b4db3bf27ba03054c3bcb37558a54f
parent488357c042b1aa34c7e4080be8662e610d595487 (diff)
Ninepatch: keep resetNode status to not lose track of ImageNode->NinePatchNode changes
Basically does what 788865b805bc91151ac8fe18bf7b92b1212ee07d did, but on the other branch. Fixes: QTBUG-87236 Change-Id: Ie8371de8a9d49054c888e4bffb7e89392a6d7c07 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 764b21987e36bc0734b7e8c9aab0e0d25771b56e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-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);