Even if saving fails, setNeedsSave(false) is still called
This is most likely happening here
https://invent.kde.org/frameworks/kcmutils/-/blob/master/src/kcmoduleqml.cpp?ref_type=heads#L263
void KCModuleQml::save()
{
d->configModule->save();
d->configModule->setNeedsSave(false);
}
even if inside my module, in case of unsuccessful save, I call setNeedsSave(true), because the settings were not saved, this does not lead to the expected result, because it overrides later. This leads to an inconsistent state of the module - settings have been changed but the "Apply" button is inactive.