diff options
| author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2025-12-09 11:00:30 +0100 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2025-12-10 14:32:15 +0100 |
| commit | 070af8ee203bf034db0c359731ade776e6e55c31 (patch) | |
| tree | e1d7efbdc156cf985b4d49b19746fec49e732f88 /src/labs/stylekit/impl/DelegateContainer.qml | |
| parent | 21d08249f6d5e511704940ba3e753afaf2aee673 (diff) | |
StyleKit: ensure we hide delegates upon setting 'visible: false'
As it stood, if you e.g did:
control.background.shadow.visible: true
control.hovered.background.shadow.visible: false
Then the shadow would stay visible also when the control
was hovered. The reason was because the shadow was already
created in the normal state, and toggling visiblity after
that point had no effect.
This patch will fix this, so that we hide the shadow if
its visibility is set to false after first having been
created. We refrain from destroying it again, since doing so
has a higher cost, and most likely, the hiding of
the shadow is just temporarily.
Task-number: QTBUG-130067
Pick-to: 6.11
Change-Id: Ib107b11b7f7fa638d7ac439348b9ccb75bf1bb1a
Reviewed-by: Doris Verria <doris.verria@qt.io>
Diffstat (limited to 'src/labs/stylekit/impl/DelegateContainer.qml')
| -rw-r--r-- | src/labs/stylekit/impl/DelegateContainer.qml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/labs/stylekit/impl/DelegateContainer.qml b/src/labs/stylekit/impl/DelegateContainer.qml index 496b4f9f5e..7ee672e655 100644 --- a/src/labs/stylekit/impl/DelegateContainer.qml +++ b/src/labs/stylekit/impl/DelegateContainer.qml @@ -147,15 +147,18 @@ Item { return const shadowProps = root.delegateProperties.shadow + const shadowVisible = shadowProps.visible && shadowProps.color.a !== 0 && shadowProps.opacity !== 0 + if (shadowInstance) + shadowInstance.visible = shadowVisible + + if (!shadowVisible) + return + const delegate = shadowProps.delegate ? shadowProps.delegate : DelegateSingleton.defaultShadowDelegate if (delegate === effectiveShadowDelegate) return - // Delay instantiating delegate until needed - if (!shadowProps.visible || shadowProps.color.a === 0 || shadowProps.opacity === 0) - return - let prevDelegateInstance = shadowInstance effectiveShadowDelegate = delegate shadowInstance = delegate |
