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
commite3753afbc1f067e6915d2adcb829b11c0ae13cf7 (patch)
treea10d5874d10bd2ac8da7c38faa2d28bb30c9809e
parent0dbcbf867c711b84bcb073f27be0f9f1a7e2372d (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);