From c4c7f5b195774d5c6e4970a28f5880cb53f1e979 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Wed, 18 Feb 2026 17:01:06 -0500 Subject: [PATCH] actiondrawer: Fix loading race conditions with minimized quick settings This reverts https://invent.kde.org/plasma/plasma-mobile/-/merge_requests/739 and avoids using loaders to load the quick settings. This otherwise leads to problems where the delegate could get half loaded and not receive model properties, due to ContentContainer also being a loader. Fixes: https://invent.kde.org/plasma/plasma-mobile/-/merge_requests/739 --- .../actiondrawer/private/QuickSettings.qml | 95 ++++++++----------- 1 file changed, 37 insertions(+), 58 deletions(-) diff --git a/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml b/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml index 5e63fdce..29d41626 100644 --- a/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml +++ b/components/mobileshell/qml/actiondrawer/private/QuickSettings.qml @@ -88,12 +88,28 @@ Item { sourceModel: root.quickSettingsModel pageSize: Math.min(root.pageSize, root.minimizedColumns) // HACK: just root.minimizedColumns appears to end up with an empty model? } - delegate: Loader { + delegate: MobileShell.BaseItem { required property var modelData - asynchronous: true + implicitHeight: root.minimizedRowHeight + implicitWidth: root.minimizedColumnWidth + horizontalPadding: (width - Kirigami.Units.gridUnit * 3) / 2 + verticalPadding: (height - Kirigami.Units.gridUnit * 3) / 2 - sourceComponent: quickSettingComponentMinimized + contentItem: QuickSettingsMinimizedDelegate { + restrictedPermissions: actionDrawer.restrictedPermissions + + text: modelData.text + status: modelData.status + icon: modelData.icon + enabled: modelData.enabled + settingsCommand: modelData.settingsCommand + toggleFunction: modelData.toggle + + onCloseRequested: { + actionDrawer.close(); + } + } } } } @@ -137,12 +153,27 @@ Item { pageSize: root.pageSize firstItem: pageSize * flow.index } - delegate: Loader { + delegate: MobileShell.BaseItem { required property var modelData - asynchronous: true + height: root.rowHeight + width: root.columnWidth + padding: Kirigami.Units.smallSpacing - sourceComponent: quickSettingComponentFull + contentItem: QuickSettingsFullDelegate { + restrictedPermissions: actionDrawer.restrictedPermissions + + text: modelData.text + status: modelData.status + icon: modelData.icon + enabled: modelData.enabled + settingsCommand: modelData.settingsCommand + toggleFunction: modelData.toggle + + onCloseRequested: { + actionDrawer.close(); + } + } } } } @@ -190,56 +221,4 @@ Item { } } - // Quick setting component minimized - Component { - id: quickSettingComponentMinimized - - MobileShell.BaseItem { - implicitHeight: root.minimizedRowHeight - implicitWidth: root.minimizedColumnWidth - horizontalPadding: (width - Kirigami.Units.gridUnit * 3) / 2 - verticalPadding: (height - Kirigami.Units.gridUnit * 3) / 2 - - contentItem: QuickSettingsMinimizedDelegate { - restrictedPermissions: actionDrawer.restrictedPermissions - - text: modelData.text - status: modelData.status - icon: modelData.icon - enabled: modelData.enabled - settingsCommand: modelData.settingsCommand - toggleFunction: modelData.toggle - - onCloseRequested: { - actionDrawer.close(); - } - } - } - } - - // Quick setting component full - Component { - id: quickSettingComponentFull - - MobileShell.BaseItem { - height: root.rowHeight - width: root.columnWidth - padding: Kirigami.Units.smallSpacing - - contentItem: QuickSettingsFullDelegate { - restrictedPermissions: actionDrawer.restrictedPermissions - - text: modelData.text - status: modelData.status - icon: modelData.icon - enabled: modelData.enabled - settingsCommand: modelData.settingsCommand - toggleFunction: modelData.toggle - - onCloseRequested: { - actionDrawer.close(); - } - } - } - } }