I update a list of WMS connections automatically with QgsSettings(). When the connection doesn't exist, it is well created with all good attributes. But when the connection already exists, and one attribute needs to be updated, the changes are not taken into account in the list of connections in the browser, but when I check the connection with the Python console, the attribute has been changed.
Here is how I do :
settings = QgsSettings()
for s in settings.allKeys():
if s.startswith(my_key):
if settings.value(s) != my_value
settings.setValue(s, my_value)
iface.reloadConnections()
# I also tried :
# settings.sync()
And if I want to modify an existing connection, I need to remove it first, then with this code it is well initialized.