quicksettings: fix dynamic removal

When a quicksetting is changed to not available, it should be removed
from the model. The proper API call to beginRemoveRows() has the index
of the last removed element as last parameter and will fail with null.

This patch makes dynamically removing a quicksetting by changing the
available property to false.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2025-08-01 12:16:30 +02:00
parent 361278b54b
commit c3ae6650ed

View file

@ -166,7 +166,7 @@ void QuickSettingsModel::loadQuickSetting(KPluginMetaData metaData, bool emitIns
void QuickSettingsModel::removeQuickSetting(int index)
{
if (index >= 0) {
beginRemoveRows({}, index, 0);
beginRemoveRows({}, index, index);
m_quickSettings.removeAt(index);
m_quickSettingsMetaData.removeAt(index);
endRemoveRows();