controlcenter: caching and no destoying of panes

This commit is contained in:
ATMDA 2025-11-16 13:28:29 -05:00
parent d9034ede8e
commit 007e94ad33

View file

@ -124,6 +124,9 @@ ClippingRectangle {
implicitWidth: root.width implicitWidth: root.width
implicitHeight: root.height implicitHeight: root.height
// Track if this pane has ever been loaded to enable caching
property bool hasBeenLoaded: false
Loader { Loader {
id: loader id: loader
@ -135,12 +138,26 @@ ClippingRectangle {
// Always activate current and adjacent panes immediately for smooth transitions // Always activate current and adjacent panes immediately for smooth transitions
if (diff <= 1) { if (diff <= 1) {
pane.hasBeenLoaded = true;
return true; return true;
} }
// For distant panes, wait until animation completes to avoid heavy loading during transition // For distant panes that have been loaded before, keep them active to preserve cached data
// Only wait for animation if pane hasn't been loaded yet
if (pane.hasBeenLoaded) {
return true;
}
// For new distant panes, wait until animation completes to avoid heavy loading during transition
return layout.animationComplete; return layout.animationComplete;
} }
onItemChanged: {
// Mark pane as loaded when item is created
if (item) {
pane.hasBeenLoaded = true;
}
}
} }
} }
} }