QIcon: don't detach in setIsMask if value doesn't change

QQuickLabsPlatformIconLoader calls setIsMask on the icon to reflect the
value from the Icon element, and usually that doesn't change the value.
Detaching it anyway results in the icon no longer reusing the cached
engine.

Task-number: QTBUG-127614
Pick-to: 6.7 6.5
Change-Id: Iead04d8a8a2342b03858cf5f72b43c51d442dd6b
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
(cherry picked from commit 55f41eb6732d5577eacaf181d5c092c3e15a2b4e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Volker Hilsheimer 2024-08-01 09:27:57 +02:00 committed by Qt Cherry-pick Bot
parent 25b1405dbf
commit 65144dba05

View File

@ -1834,6 +1834,9 @@ QIcon QIcon::fromTheme(QIcon::ThemeIcon icon, const QIcon &fallback)
*/
void QIcon::setIsMask(bool isMask)
{
if (isMask == (d && d->is_mask))
return;
detach();
if (!d)
d = new QIconPrivate(new QPixmapIconEngine);